javascript validation for a string given in the textbox of a form [closed]
i have created a form having an input textbox with button.
Once I enter the string "run" in the input text box of form (specifically) it should show the page containing three boxes.the thing is am not able to implement the javascript for validating or checking that particular "run" string.
but am getting the box containing pages.
please give me suggestions r help me开发者_如何学Python to solve this problem.
I think this you wanted to compare the string "run" and if it matches then redirect to the page which contains 3 boxes !!
<html>
<head>
<script type="text/javascript">
function validatetxtbox()
{
var txtfield;
txtfield =document.getElementById('txtbox').value;
if(txtfield == "run")
{
alert("you entered string right");
window.onload="url u want to redirect after checking entered string is right"
}
else
{
alert("Try again");
}
}
</script>
</head>
<body>
<input type="text" id="txtbox" maxlength="3">
<input type="button" id="btn" value="Send" onclick="validatetxtbox()">
</body>
精彩评论