html - Javascript code not working in Firefox -


i have dropdown list box. if user hasn't selected anything, should not go next page. tried something. code works fine in ie , chrome. it's going next page in firefox. why this?

<td width="100" align="right">     <div style="text-align:center;">        <input type="button" value="next" align="top" style="width: 70px;" onclick="gt();">     </div> </td>   <script type="text/javascript">     function gt_nextpage()     {         var e=document.getelementbyid("parenttype");         var val=e.options[e.selectedindex].value;         window.location.replace("gt_iba1?value="+val);     }      function gt()     {         var e=document.getelementbyid("parenttype");         var val=e.options[e.selectedindex].value;         if(val != null)         {             gt_nextpage();           }         if(val === "")         {             alert("please select value");             window.location.replace("gt_iba?value="+val);         }     }  </script>  

i have added inside jsp page.

try this

function gt() {     var e=document.getelementbyid("parenttype");     var val=e.options[e.selectedindex].value;     if(val != null && val !== "")     {         gt_nextpage();       }     else     {         alert("please select value");         window.location.replace("gt_iba?value="+val);     } }  

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -