|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dear All,
I have a form validation script that works in IE, but not in netscape, and I need obviously, it to work in both. Any suggestions you have would be greatfully received. I'm no expert at this, but from what I can see, everything looks alright. Hope it's a simple one... Thanks Richard <script language = "JavaScript"> <!-- function validate() { if (form.elements[1].checked=="1" | | form.elements[3].checked=="1" | | form.elements[5].checked=="1" | | form.elements[7].checked=="1") { message="NextCall is best suited for BT customers who spend more than £70 per month and who pay for their service by Direct Debit"; alert(message); return false; } else { MM_openBrWindow('http://www.MYURL.co.uk/signup/signup01.asp?mode=residential','registerwindow','status=yes,scrollbars=yes,resizable=yes,width=800,h eight=600') return true; } } function MM_callJS(jsStr) { //v2.0 return eval(jsStr) } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } function OpenWindowTest(){ MM_openBrWindow('http://www.MYURL.co.uk/signup/signup01.asp?mode=residential','registerwindow','status=yes,scrollbars=yes,resizable=yes,width=800,h eight=600') return true; } //--> </script> ... And the script on the page is as follows: <form name="form" method="get" onsubmit="return MM_callJS('validate()')"> <table border="0" cellspacing="0" cellpadding="4" width="310"> <tr> <td colspan="2" > <p><font face="Arial, Helvetica, sans-serif" color="#001889"><b>Register with NextCall<br> <img src="../gifs/Dot.gif" width="1" height="20"> </b></font></p> <p><font face="Arial, Helvetica, sans-serif" size="-1" color="#000E78">Please answer the following questions:</font></p> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="71%" height="20" rowspan="2"><font face="sans-serif" size="-1" color="#000E78">Are you a BT Customer?</font></td> <td width="15%" height="20"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">Yes </font></div> </td> <td width="15%" height="20"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">No</font></div> </td> </tr> <tr> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="btcust" value="yes"> </font></div> </td> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="btcust" value="no" checked> </font></div> </td> </tr> <tr> <td width="71%" height="20" rowspan="2"><font face="sans-serif" size="-1" color="#000E78">Do you have a Bank Account?</font></td> <td width="15%" height="20"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">Yes </font></div> </td> <td width="15%" height="20"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">No</font></div> </td> </tr> <tr> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="bank" value="yes"> </font></div> </td> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="bank" value="no" checked> </font></div> </td> </tr> <tr> <td width="71%" rowspan="2"><font face="sans-serif" size="-1" color="#000E78">Do You Spend £70 or more per quarter with BT?</font></td> <td width="15%"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">Yes </font></div> </td> <td width="15%"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">No</font></div> </td> </tr> <tr> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="spend" value="yes"> </font></div> </td> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="spend" value="no" checked> </font></div> </td> </tr> <tr> <td width="71%" height="20" rowspan="2"><font face="sans-serif" size="-1" color="#000E78">Are you the authorised person to change your telephone account?</font></td> <td width="15%" height="20"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">Yes </font></div> </td> <td width="15%" height="20"> <div align="center"><font face="sans-serif" size="-1" color="#000E78">No</font></div> </td> </tr> <tr> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="auth" value="yes"> </font></div> </td> <td width="15%" height="20"> <div align="center"> <font face="sans-serif" size="-1" color="#000E78"> <input type="radio" name="auth" value="no" checked> </font></div> </td> </tr> </table> </td> </tr> <tr> <td width="168"> </td> <td width="214"> <input type="submit" name="submit" value="Send"> <input type="reset" name="reset" value="Reset"> </td> </tr> <tr> <td width="168" height="32"> </td> <td width="214" height="32"> </td> </tr> <tr> <td width="168" colspan="2"> </td> </tr> </table> </form> |
|
#2
|
|||
|
|||
|
Without spending alot of time reviewing your code, one thing pops out to me. Netscape requires syntax to be 'proper' where IE tends to be more forgiving on this point.
Everyplace you make reference to the form object should be prefaced by 'document.' For example, the following segment of your script should be: <script language = "JavaScript"> <!-- function validate() { if (document.form.elements[1].checked=="1" | | document.form.elements[3].checked=="1" | | document.form.elements[5].checked=="1" | | document.form.elements[7].checked=="1") Unless I missed something else in my brief lookthrough, I'm pretty sure this should solve your problem. Russ |
|
#3
|
|||
|
|||
|
Greetings!
Thanks very much for your help... Everything works fine now URL) Kind regards Richard |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Script Works in IE, not in Netscape! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|