Last active
December 21, 2015 12:24
-
-
Save amirulasyraf88/2f428681ce77cca23764 to your computer and use it in GitHub Desktop.
Website Question 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
#topform{ | |
padding-top: 50px; | |
margin: 0 auto; | |
} | |
#main{ | |
width: 20%; | |
margin: 0 auto; | |
border: none; | |
-webkit-border-radius: 20px; | |
-moz-border-radius: 20px; | |
border-radius: 20px; | |
background: rgba(255,255,255,1); | |
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 47%, rgba(245,245,245,1) 100%); | |
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,1)), color-stop(47%, rgba(255,255,255,1)), color-stop(100%, rgba(245,245,245,1))); | |
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 47%, rgba(245,245,245,1) 100%); | |
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 47%, rgba(245,245,245,1) 100%); | |
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 47%, rgba(245,245,245,1) 100%); | |
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 47%, rgba(245,245,245,1) 100%); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#f5f5f5', GradientType=0 ); | |
box-shadow: 0px 0px 10px #888888; | |
} | |
#box{ | |
width: 250px; | |
margin: 0 auto; | |
padding-left: 10px; | |
padding-right: 10px; | |
} | |
</style> | |
<script>//html5 define by itself | |
function validate(){ | |
var emailID = document.q5form.EMail.value; | |
atpos = emailID.indexOf("@"); | |
dotpos = emailID.lastIndexOf("."); | |
if( document.q5form.Name.value == "" ) | |
{ | |
alert( "Please write your name!" ); | |
document.q5form.Name.focus() ; | |
return false; | |
} | |
if (atpos < 1 || ( dotpos - atpos < 2 )) | |
{ | |
alert("Please enter correct email address") | |
document.q5form.EMail.focus() ; | |
return false; | |
} | |
if( document.q5form.Zip.value == "" || | |
isNaN( document.q5form.Zip.value ) || | |
document.q5form.Zip.value.length != 3 ) | |
{ | |
alert( "Please spesify your age." ); | |
document.q5form.Zip.focus() ; | |
return false; | |
} | |
if( document.q5form.gender.value == "-1" ) | |
{ | |
alert( "Please provide choose your gender" ); | |
return false; | |
} | |
return( true ); | |
document.getElementById("topform").action = confirm("Lancar!"); | |
} | |
function Reseting() { | |
document.getElementById("topform").reset(); | |
} | |
</script> | |
</head> | |
<body> | |
<form id="topform" action="http://www.magnifera.xyz/" name="q5form" onsubmit="return(validate());"> | |
<fieldset id="main"> | |
<center><img src="https://s-media-cache-ak0.pinimg.com/originals/39/97/49/3997496840511bd9754a9d2bf87839ff.gif" alt="MMUzilla" width="100%" ></center> | |
<table id="box"> | |
<tr> | |
<td>Name: </td> | |
<td><input type="text" name="Name" required></td> | |
</tr> | |
<tr> | |
<td>eMail: </td> | |
<td><input type="text" name="EMail" required></td> | |
</tr> | |
</tr> | |
<tr> | |
<td>Age: </td> | |
<td><input type="number" maxlength="2" size="2" name="age" required></td> | |
</tr> | |
<tr> | |
<td>Gender: </td> | |
<td><select name="gender" required> | |
<option value="male">Male</option> | |
<option value="female">Female</option> | |
</select></td> | |
</tr> | |
<tr> | |
<td><input type="button" onclick="Reseting()" value="Reset"></td> | |
<td><input type="submit" value="Submit" /></td> | |
</tr> | |
</table> | |
</fieldset> | |
</form> | |
</body> | |
</html> | |
//Amirul Asyraf Mohamed Azam (www.magnifera.xyz/me@magnifera.xyz) | |
//MYSOURCE:https://gist.github.com/creativiousa/2f428681ce77cca23764/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Done