Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Java in Netscape

Status
Not open for further replies.

Harshmellow

Programmer
Mar 28, 2002
18
BR
Hello!

I´ve post this on the Java forum, and now I´m expanding this to this forum too: I´m using a javascript and it works fine on Explorer browsers, but it doesn´t work in Netscape. Why does this happen and HOW can I solve this? Asap!

my code is as follows:

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

function validate(form)
{
if (form.pass.value != form.confirmpass.value) {
alert(&quot;Passwords do not match!&quot;);
form.pass.value = '';
form.confirmpass.value = '';
form.pass.focus();
return false;
}
return true;
}
</SCRIPT>


And the function is called from the onSubmit form function, like this:

<form method=&quot;POST&quot; action=&quot;FileName&quot; name=&quot;form&quot; onSubmit=&quot;return validate(this)&quot;>

Thanks in advance, .: HarshMellow :. &quot;Sperto ne estas tio, kio okazis al vi, sed estas tio, kion vi faras al tio, kio okazas al vi.&quot; (Aldous Huxley)
 
It's possible that there are some collisions happening because you've named everything &quot;form&quot;. I'm especially concerned because &quot;form&quot; is the name of a built-in object, so there may be some name collisions there. I suggest using &quot;frm&quot; to prefix any form names, so your form would be named &quot;frmLogon&quot; or whatever; also rename the validate() function's parameter to &quot;objTargetForm&quot; or something like that (I like to use &quot;obj&quot; to prefix object references).

If that doesn't solve it, you might try changing the validate() function so that it doesn't need a parameter at all -- simply reference document.forms.formname directoy in the function.

If neither of these suggestions helps, perhaps you could also post the
Code:
<input>
tags and describe more fully the error (any error messages, etc.).
 
Thank you, pcorreia!

I'll try to use this syntax on my new scripts, I think it helps a lot, but I'm new to scripting. And then, I don't understand too much about parameters and so (really dumb must I be, huh), but what I've done, which solved the problem, is to name (I think this is how its called) the directory to a parameter (I think), like:

function validate(form)
{
pass = frm.pass.value
confirmpass = frm.confirmpass.value
   if (pass != confirmpass) {
      alert(&quot;Passwords do not match!&quot;);
      pass = '';
      confirmpass = '';
      frm.pass.focus();
      return false;
   }
   return true;
}


It worked fine for verifying the two fields, but it didn't work to erase the values... even when I changed the code like the older one for the part frm.pass.value = '';... but still worked the focus.

Thanks a lot!

.: HarshMellow :. &quot;Sperto ne estas tio, kio okazis al vi, sed estas tio, kion vi faras al tio, kio okazas al vi.&quot; (Aldous Huxley)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top