select() statement..help me plzz..
hi..anyone can help me solve this prob...actually when these codes run in IE, there is no prob at all..but not with mozilla firefox..plz help me...
[highlight="JavaScript"]<html>
<head>
<script type="text/javascript">
window.onload=function()
{
var inps=document.getElementsByTagName('input');
for(var i=0;i<inps.length-1;i++)
{
inps[i].onblur=function()
{
if(this.value.indexOf('/')!=-1&&(this.value.length>1))
{
alert('Answers should either be number or slash only!\nNo Combination Please.');
this.select();
}
}
}
}
</script>
</head>
<body>
<p>Please enter your answer or type ( / ) if you don't know the answer.<br>
Your answer may not contain both numbers and ( / ) sign.<br><br>
34 + 54 = <input type=text size="6"></p>
<p>123 + 76 = <input type=text size="6" name="T1"></p>
<input type=submit value="Check Answer!">
</body>
</html>[/highlight]
Last edited by SpOrTsDuDe.Reese; 06-12-2008 at 11:27 AM.
Reason: Added [highlight] tags
|