I'm trying to use javascript with NO Innerhtml. i am very new to javascript and i need a little help completing this form. the code i have so far to create a form page is just below this message.
How do i create a code when focused the text fields should offer a hint to the right of the text field that indicates how the user should input data??
When unfocused, the validateData() function should be called.
also how do i create my 2 survey questions a radio buttons??
<script type="text/javascript">
function assignHandlers()
{
document.getElementById("fname").onblur = function()
{
if (document.forms[0].fname.value !="")
alert(document.forms[0].fname.value);
}
}
window.onload=assignHandlers;
</script>
</head>
<body>
<form>
<fieldset><legend>User Info</legend>
<label for="fname">First name</label><input type="text" name="fname" id="fname" />
<br/>
<label for="lname">Last name</label><input type="text" name="lname" /> <br/>
<label for="email">email</label><input type="text" name="email" /> <br/>
<label for="phone">Phone Number</label><input type="text" name="phone" /> <br/>
<label for="url">Sulley Website</label><input type="text" name="url" /> <br/>
</fieldset>
<fieldset><legend> Survey</legend>
<label for="question1">Do you drink alcohol?</label>
<input type="radio" name="question1" value="true" />True
<input type="radio" name="question1" value="false" />False <br/>
<label for="question2"> Do you have a DUI?</label>
<input type="radio" name="question2" value="true" />True
<input type="radio" name="question2" value="false" />False <br/>
</fieldset>
<input type="submit" name="submit" value="Submit!" />
</form>
</body>