View Single Post
Old 06-12-2008, 11:26 AM   #2 (permalink)
SpOrTsDuDe.Reese
Senior Moderator
 
SpOrTsDuDe.Reese's Avatar
Default

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>
Your code seems to be a bit quirky. Like this line for example something looks wrong.

inps[i].onblur=nice();
__________________
+-(X)HTML, CSS, JavaScript, SEO, PHP, Flash-+
Code:
<style type="text/css"> u { text-decoration: none; } </style>
GameYin. Redesigning for DevPlooth.
SpOrTsDuDe.Reese is offline   Reply With Quote