Extracting JavaScript into separate file (from HTML). Duplicate call to function needed
<p>See the source of <a href="http://marakana.com/s/post/1096/samples/try6.htm" rel="nofollow">http://marakana.com/s/post/1096/samples/try6.htm</a>
It defines a function and calls it on load of document. (Which is the final step of <a href="http://marakana.com/s/post/1096/using_the_html5_attribute_contenteditable_to_create_a_wysiwyg" rel="nofollow">this tutorial</a>)</p>

<p>I tried to put it into a seperate JS file.
Runs correctly only if I call onload both in JS and in HTML.
But not only body onload or only from JS. I guess I am doing something wrong.
So, following works:</p>

<pre><code>&lt;head&gt;
&lt;script src="Scripts/makeWYSIWYG.js" type="text/javascript"/&gt;
&lt;script type="text/javascript"&gt;
            window.onload = function () {
               makeWYSIWYG(document.getElementById('editor'));
            };
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="makeWYSIWYG(document.getElementById('editor'));"&gt;
</code></pre>

<p>Why do I need to call the function twice?</p>

<p>I only have the function definition in "Scripts/makeWYSIWYG.js" 
    function makeWYSIWYG(editor) {
    ...
        return editor;
    };</p>

<p>Thanks,</p>
