I am a newbi to webdesign/php and javascript and I am having a problem. Please look at this code:
<script type="text/javascript">
<!--
function thanksDiv(){
document.getElementById("myThanksDiv").style.display ='block';
}
function hideDiv(id){
document.getElementById(id).style.display='none';
}
//-->
</script>
<form id="contacts-form" method="post" action="email.php" target="myiframe">
<fieldset>
<div class="alignright"><a href="#" onClick="document.getElementById('contacts-form').submit()">Send Your Message!</a></div>
</fieldset>
</form>
<iframe name="myiframe" id="myiframe" src="" width=1 height=1 style="visibility:hidden;position:absolute;"></iframe>
<div id="myThanksDiv" style="width:200px;height:150px;position:absolute;left:50%; top:20px; margin-left:-100px;border:1px solid black; background:#fff;display:none;padding:20px;">Thanks! <br />Your message was sent.</div>
and in email.php:
echo '<script type="text/javascript">'
, thanksDiv();'
, '</script>';
?>
The idea is that when I click on 'Send Your Message' I should see a box saying 'message was sent', but I don't.
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?