خرید بک لینک
I have the following code and never understands why nothing happens when input is invalid, e.g. input a string instead of numbers, or inputting numbers not within the range.

I've checked with browser's F12, but it does not give me any warnings or error...



<!DOCTYPE html>
<html>
<head>
<script>
function validator(){
var x = document.form1.in.value;
if(isNaN(x) || x > 10 || x < 1){
document.form1.in.ierHTML = "Invalid";
return false;
}
}
</script>
</head>

<body>
<h1>JavaScript Can Validate</h1>
<p name="id">Please input btw 1 to 10</p>
<form name="form1" onsubmit="return validator()">
<input type="text" name="in">
<input type="submit" name="Submit" />
</form>

</body>
</html>

برچسب: نویسنده: آیلین رضوانی تاريخ: سه شنبه 13 تير 1396 ساعت: 22:18

صفحه بندی