Forum Moderators: open

Message Too Old, No Replies

Javascript not working in Netscape

A javascript form validator is not functioning in Netscape

         

Rajiv

6:35 am on Jul 3, 2004 (gmt 0)

10+ Year Member



Hi..

I have a html form with few fields and a simple javascript form validator. This javascript is called in a separate .js file which in included in the <head> section of the html file.

<head>
<script language="JavaScript" type="text/javascript" src="scripts/formvalidate.js"></script>
</head>

Now, the same form works with IE and does not work with Netscape 7.1. In Netscape, without giving any error the form moves on to next page after clicking the "Submit" button.

Please help!

With warm regards
Rajiv

Rambo Tribble

1:46 pm on Jul 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Without seeing the actual validation code it is hard to come to any conclusions. Assuming you are using the onsubmit event to trigger the validator, remember that the validator function needs to return true for submission to proceed.

Rajiv

2:51 am on Jul 5, 2004 (gmt 0)

10+ Year Member



Hi .. thank you for your reply.. I tried inserting the script in the same html file and then checked the same in both IE and Netscape. To my surprise it worked!

So, the problem with Netscape was about calling an .js file.

As of now the form and the html file is up and live for visitors to send their queries. But, the question still hangs as to why Netscape does not allow .js filed to be called. Any comments regarding this would be highly appreciated.

Thank you once again for your input
With warm regards
Rajiv

Rambo Tribble

1:34 pm on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Netscape should work fine with an external file. Perhaps there is something about your external file that isn't quite right. You did remember to remove the <script> tags? How are you calling the file?

PCInk

1:58 pm on Jul 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



In Netscape, allow the "error" (or mistake) to happen. Then type "javascript:" (without the quotes) into the address bar. It will show you where any error occured.

If you have Norton AntiVirus or Firewall installed, it will insert a piece of code so javascript errors are supressed.

[edited by: DrDoc at 4:58 pm (utc) on July 5, 2004]
[edit reason] typo [/edit]

coopster

2:59 pm on Jul 5, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Then type "javascript:" (without the quotes) into the address bar. It will show you where any error occured.

Right. NN has a Javascript Console that comes in quite handy for troubleshooting. Another way to get there is from the menu -- Tools¦Web Development¦JavaScript Console. One thing I do notice is that you are using a deprecated attribute [w3.org],

language="JavaScript"
. You can omit that attribute now since you have the
type
attribute specified.
<script type="text/javascript" src="scripts/formvalidate.js"></script>

[edited by: DrDoc at 4:59 pm (utc) on July 5, 2004]
[edit reason] typo in quote [/edit]