how do I automatically execute javascript?

Posted by user317005 on Stack Overflow See other posts from Stack Overflow or by user317005
Published on 2010-04-15T10:56:52Z Indexed on 2010/04/15 11:03 UTC
Read the original article Hit count: 307

how do I automatically execute javascript?

I know of < body onLoad="" >, but I just thought maybe there is another way to do it?

html:

<html><head></head><body><div id="test"></div></body></html>

javascript:

<script>(function(){var text = document.getElementById('test').innerHTML;var newtext = text.replace('', '');return newtext;})();</script>

I wanna get the text within "test", replace certain parts, and then output it to the browser.

Any ideas on how to do it? I'd appreciate any help. Thanks.

© Stack Overflow or respective owner

Related posts about javascript-execution

Related posts about JavaScript