Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: document.forms[0].submit failure in netscape for linux


Message #1 by jfreese@m... on Wed, 7 Nov 2001 16:15:06 -0500
The following simple html script works in Nescape for Windows V4.75 and IE5.5,
but does not work in Netscape for Linux, V4.6 or V7.2

Specifically, Netscape for Linux will execute the submit the form when invoked
by <select onChange>, <input type=radio onClick> or <input type=checkbox
onClick>, but not by
<a onclick>.

More specifically, the <a onclick> does indeed execute the doform() function (I
know this because commands like window.alert(); or
document.forms[0].gear.value=xgear; work fine if included), but the form does
not get submitted.

Can anyone tell me why, or recommend an alternate way of submitting the form
from a javascript function?


<html>
<head>

<script language="javascript">
<!--hide
   function doform()
   {
      document.forms[0].submit();
   }
//stop hiding -->
</script>

</head>
<body>

<form action='/cgi-bin/someprog.prl' target='_blank'>
<a href='#' onClick="doform();">Submit via onclick event</a>
<br>or<br>
<input type=submit name=gobutton value=' Go '>
<br>or<br>
<select name="month" onChange="doform()">
   <option value= "a" selected > a </option>
   <option  value= "b"> b </option>   
   <option  value= "c"> c </option>
</select>
<br>or<br>
<input type="radio" value="1" onClick="doform()"> 
<br>or<br>
<input type="checkbox"  checked="unchecked" onClick="doform()"> 
<input type="checkbox"  checked="unchecked" onClick="doform()"> 
</form>

</body>
</html>

  Return to Index