<!DOCTYPE html> <html lang="en"><head> <meta charset="utf-8"> <title>JavaScript Form Validation using a sample registration form</title> <meta name="keywords" content="example, JavaScript Form Validation, Sample registration form" /> <meta name="description" content="This document is an example of JavaScript Form Validation using a sample registration form. " /> <link rel='stylesheet' href='js-form-validation.css' type='text/css' /> <script src="sample-registration-form-validation.js"></script> </head> <body onload="document.registration.userid.focus();"> <h1>Registration Form</h1> Use tab keys to move from one input field to the next. <form name='registration' onSubmit="return formValidation();"> <ul> <li><label for="userid">User id:</label></li> <li><input type="text" name="userid" size="12" /></li> <li><label for="passid">Password:</label></li> <li><input type="password" name="passid" size="12" /></li> <li><label for="username">Name:</label></li> <li><input type="text" name="username" size="50" /></li> <li><label for="address">Address:</label></li> <li><input type="text" name="address" size="50" /></li> <li><label for="country">Country:</label></li> <li><select name="country"> <option selected="" value="Default">(Please select a country)</option> <option value="AF">Australia</option> <option value="AL">Canada</option> <option value="DZ">India</option> <option value="AS">Russia</option> <option value="AD">USA</option> </select></li> <li><label for="zip">ZIP Code:</label></li> <li><input type="text" name="zip" /></li> <li><label for="email">Email:</label></li> <li><input type="text" name="email" size="50" /></li> <li><label id="gender">Sex:</label></li> <li><input type="radio" name="msex" value="Male" /><span>Male</span></li> <li><input type="radio" name="fsex" value="Female" /><span>Female</span></li> <li><label>Language:</label></li> <li><input type="checkbox" name="en" value="en" checked /><span>English</span></li> <li><input type="checkbox" name="nonen" value="noen" /><span>Non English</span></li> <li><label for="desc">About:</label></li> <li><textarea name="desc" id="desc"></textarea></li> <li><input type="submit" name="submit" value="Submit" /></li> </ul> </form> </body> </html>
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>