Wednesday, August 7, 2013

Javascript code not working in firefox 16.0.1

Javascript code not working in firefox 16.0.1

I have a dropdown list box.If a user isn't selected anything,it should not
go to next page.For that I tried something.That code works fine in IE and
chrome.But it 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 any value");
window.location.replace("gt_Iba?value="+val);
}
}
</script>
I have added this inside my jsp page.
Thanks

No comments:

Post a Comment