Seattle Web Design Seattle Web Design

Simple JavaScript Code

This is how you can make a very simple form and play with it by using onclick attribute. 


<!DOCTYPE html>
  <title>Playing around with Forms</title>
  <meta charset="windows-1252">
  // make a function
  function fred() {
  window.alert("hi " +; = "";
  function cb() {
  var type;
  if(document.oneb.unmask.checked) {
  type = 'text';
  } else {
  type = 'password';
  document.oneb.pwd.type = type;
  <body onload="cb();">
  <h1 id='title' onclick='style.display="none";'>Playing around with Forms</h1>
  <form name="oneb">
  Name: <input type="text" name="name" value='bob'><br>
  Age: <input type='text' name='age' value='99'><br>
  Email: <input type='text' name='email' value=''><br>
  Password: <input type='password' name='pwd' value='xyzzy'>
  Unmask <input type='checkbox' name='unmask' onclick='cb();'><br/>
  <input type='submit'>
  <input type='button' value='Checking'
  <input type='button' value='Come back'
  onclick='document.getElementById("title").style.display = "block";'>

Leave a Reply

Kianoush Facebook Profile Kianoush Google Plus Profile Kianoush LinkedIn Profile Find Kianoush Twitter