![]() |
|
|||||||
| Register | FAQ | Members List | Arcade | Dev Directory | HB Bank | Calendar | Search | Today's Posts | Mark Forums Read |
| JavaScript Programming Discuss javascript coding. |
| Have A Look At Some Of Our Webmaster Related Sponsors! | |||||
![]() Script Directory |
![]() Advertise Here |
![]() Market Leverage |
![]() Free Templates |
![]() 3D Guide-characters |
![]() Advertise Here |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
New Hunter
|
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 10:27 AM. Reason: Added [highlight] tags |
|
|
|
|
|
#2 (permalink) |
|
Senior Moderator
|
Try
Code:
<html>
<head>
<script type="text/javascript">
function nice() {
var inps=document.getElementsById('box');
for(var i=0;i<inps.length-1;i++)
{
inps[i].onblur=nice();
{
if(inps.value.indexOf('/')!=-1 && (inps.value.length>1))
{
alert('Answers should either be number or slash only!nNo Combination Please.');
inps.select();
}
}
}
}
</script>
</head>
<body onLoad="cool();">
<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" id="box></p>
<input type=submit value="Check Answer!">
</body>
</html>
inps[i].onblur=nice();
__________________
+-(X)HTML, CSS, JavaScript, SEO, PHP, Flash-+ Code:
<style type="text/css"> u { text-decoration: none; } </style>
|
|
|
|
|
|
#4 (permalink) |
|
Senior Moderator
|
No I didn't run it. Though I'd go to forums.devshed.com and post there. They have some real geniuses there.
__________________
+-(X)HTML, CSS, JavaScript, SEO, PHP, Flash-+ Code:
<style type="text/css"> u { text-decoration: none; } </style>
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|