I have a chunk of php code where the first line is to echo a call to a javascript function...the function doesn't get executed, why?? Below is the code, please help! <BODY> <FORM ID="genericform" ACTION="systemconfig-generic.php" METHOD="post"/> <INPUT TYPE=submit NAME="newconfigbutton" VALUE="Create New Configuration"> <?php if(isset($_POST['newconfigbutton'])) { echo '<script>displayNewConfig();</script>'; echo '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">'; echo '<TR><BR>'; echo '<TD><B><FONT SIZE=2>Item 1</TD></B></FONT></TR>'; echo '<TR><TD ID="textfields"><FONT SIZE=2><SIZE=30>Description<INPUT ID="textfields" TYPE="text" NAME="description" VALUE=""></FONT></SIZE>'; echo '<FONT SIZE=2><SIZE=30Part Number <INPUT ID="textfields" TYPE="text" NAME="partno" VALUE="" ONKEYDOWN="if (event.keyCode==9) { addNewItem(); }"><BR></TD></FONT></SIZE></TR>'; echo '</TABLE><BR><BR>'; } ?> </FORM> </BODY> <HEAD> <SCRIPT LANGUAGE="Javascript" TYPE="text/javascript"> function displayNewConfig() { document.getElementById('firstChoice').style.display='none'; document.getElementById('firstChoice').value=""; document.getElementById('secondChoice').style.display='none'; document.getElementById('secondChoice').value=""; document.getElementById('unitname').style.display=''; document.getElementById('unitname').focus(); document.getElementById('unitpartno').style.display=''; document.getElementById('unitpartno').focus(); // hide the fake save and cancel buttons document.getElementById('dummysave').style.display='none'; document.getElementById('dummycancel').style.display='none'; // create real submit and cancel buttons document.getElementById('save').style.display=''; document.getElementById('cancel').style.display=''; } </SCRIPT> </HEAD> Code (markup):
Are you really situating the BODY area above the HEAD or is it simply an error when pasting the code here? Cause maybe you do not know, but it should be the opposite.
By the way: I didn't want to mean that changing it will work (I don't know, I didn't look at the code itself), but that was so obvious.