Web Design - Technical Design - HTML and JavaScript Assignment 18

 

Javascript Assignment 9
 HTML & JavaScript 

<html>
<head><title>javascript Purchasing Form</title>
<script type="text/javascript"language="javascript">
function uservalidation(){
var company = document.getElementById("comp");
var product = document.getElementById("prod");
var model = document.getElementById("model");
var name = document.getElementById("name");
var phone = document.getElementById("phone");
var email = document.getElementById("email");
var address = document.getElementById("address");
var country = document.getElementById("country");
var agree = document.getElementById("agree");
if (company.value == "") {
alert("Please Enter Company Name");
company.focus();
return false;
}
if (product.value == "") {
alert("Please Enter Product Name");
product.focus();
return false;
}
if (model.value == "") {
alert("Please Type the Model Of your Product");
model.focus();
return false;
}
if (name.value == "") {
alert("Please Enter Your Name");
name.focus();
return false;
}
if (phone.value == "") {
alert("Please Enter your Phone Number.");
phone.focus();
return false;
}

if (email.value == "") {
alert("Please Enter Complete Email Address");
email.focus();
return false;
}
if (address.value == "") {
alert("Please Enter Complete Address");
address.focus();
return false;
}
if (country.value == "") {
alert("type Your Country Name");
country.focus();
return false;
}
if (agree.value == "") {
alert("Please Enter valid Password");
agree.focus();
return false;
}
else{
window.open("printform.html" , "sbwindow", "width=300 , height=300" )
}
}
</script>
</head>
<body>
<formt id="userinfo" method="post">
<table>
<tr>
<td>Company Name</td>
<td><input type="text" id="comp" /></td>
</tr>
<tr>
<td>Product Name</td>
<td><input type="text" id="prod" /></td>
</tr>
<tr>
<td>Model</td>
<td><input type="text" id="model" /></td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" id="name" /></td>
</tr>
<tr>
<td>Phone</td>
<td><input type="text" id="phone" /></td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type="text" id="email" /></td>
</tr>
<tr>
<td valign="top">Address</td>
<td><textarea id="address" cols="25" rows="3" > </textarea></td>
</tr>
<tr>
<td>Country</td>
<td>
<input type="text" id="country" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="checkbox" id="agree" />I am Agree</td>
<tr>
<td>&nbsp;</td>
<td><input type = "submit" value = "Next" onclick = "return uservalidation();"  /></td>
</tr>
</table>
</form>
</body>
</html>

Post a Comment

Previous Post Next Post