how do I automatically execute javascript?
<p>how do I automatically execute javascript?</p>

<p>I know of <code>&lt;body onLoad=""&gt;</code>, but I just thought maybe there is another way to do it?</p>

<p>html:</p>

<pre><code>&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div id="test"&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>

<p>javascript:</p>

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

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

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