Forum Moderators: open
Can any one guide me, how it will work on Netscape
function validity()
{
elmt6=document.f1.spl_lname.value;
elmt7=document.f1.spl_name.value;
if (elmt6 == '')
{
alert('Last Name cannot be left blank..!');
document.f1.spl_lname.focus();
return false;
}
if (elmt7 == '')
{
alert('First Name cannot be left blank..!');
document.f1.spl_name.focus();
return false;
}
}
Instead of referring to the page element like:
document.f1.spl_lname
use a fully-qualified reference, like:
document.forms["f1"].elements["spl_lname"]
You are relying on Internet Explorer to assume it knows what you are referring to, under its "document.all" DOM...and that ain't right. Use a fully-qualified reference so that browsers that actually support the standard can respond, and IE will follow.