php echoing javascript call
<p>I am a newbi to webdesign/php and javascript and I am having a problem. Please look at this code:</p>

<pre><code>  &lt;script type="text/javascript"&gt;
&lt;!--
function thanksDiv(){
    document.getElementById("myThanksDiv").style.display ='block';
}
function hideDiv(id){
    document.getElementById(id).style.display='none';
}

//--&gt;
&lt;/script&gt;

        &lt;form id="contacts-form" method="post" action="email.php" target="myiframe"&gt;
           &lt;fieldset&gt;

           &lt;div class="alignright"&gt;&lt;a href="#" onClick="document.getElementById('contacts-form').submit()"&gt;Send Your Message!&lt;/a&gt;&lt;/div&gt;
           &lt;/fieldset&gt;
        &lt;/form&gt;

&lt;iframe  name="myiframe" id="myiframe" src="" width=1 height=1 style="visibility:hidden;position:absolute;"&gt;&lt;/iframe&gt;

&lt;div id="myThanksDiv" style="width:200px;height:150px;position:absolute;left:50&amp;#37;; top:20px; margin-left:-100px;border:1px solid black; background:#fff;display:none;padding:20px;"&gt;Thanks! &lt;br /&gt;Your message was sent.&lt;/div&gt;
</code></pre>

<p>and in email.php:</p>

<pre><code>echo '&lt;script type="text/javascript"&gt;'
   , thanksDiv();'
   , '&lt;/script&gt;';
?&gt;
</code></pre>

<p>The idea is that when I click on 'Send Your Message' I should see a box saying 'message was sent', but I don't.</p>

<p>If I don't go through the email.php page and I just call thanksDiv from the form submit link it works. Any idea why?</p>
