Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: works fine in ie and not in netscape


Message #1 by "taherm@f... on Thu, 18 Apr 2002 13:17:21
hi
you must use the selectedIndex for compare .

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">
<script language="JavaScript">
function MM_validateForm(form)
{ 
 if (document.form1.title1.selectedIndex == 0)
 {
  alert ('Please Select Title');
  return false;
 }
}

</script>
</head>
<body>
my form tag is as follows

   <form method="POST" name="form1" onSubmit="return MM_validateForm(this)" action="try.html" >
  <select name="title1" >
    <option value="NO">Select</option>
    <option value="1">Mr</option>
    <option value="2">Mrs</option>
    <option value="3">Miss</option>
    <option value="4">Dr</option>
    <option value="5">Sir</option>
    <option value="6">Ms</option>
     </select>
     <INPUT TYPE="submit" name=submit value="submit">
</form>
</body>
</html>
----- Original Message ----- 
From: <taherm@f...>
To: JavaScript HowTo <javascript_howto@p...>
Sent: Thursday, April 18, 2002 1:17 PM
Subject: [javascript_howto] works fine in ie and not in netscape


> Can some on check my javascript for me..it works fine in IE but is totally 
> ignored in netscape..
> 
> <head>
> <title></title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <link rel="stylesheet" href="style.css" type="text/css">
> <script language="JavaScript">
> <!--
> 
> function MM_validateForm(form) { file://v4.0
> if (document.form1.title.value == "NO"){
> alert ('Please Select Title');
> return false;
> }
> }
> 
> file://-->
> </script>
> </head>
> 
> my form tag is as follows
> 
>    <form method="POST" name="form1" onSubmit="return MM_validateForm
> (this)" action="<%=MM_editAction%>" >
> 
> 
> please help me...
> 
> 
> thanks a million
> 
> 
> 
> 
> ---
> 
> Improve your web design skills with these new books from Glasshaus.
> 
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/190415
1027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
>
>



  Return to Index