<HTML> <HEAD> <TITLE>Beatle Picker</TITLE> <SCRIPT LANGUAGE="JavaScript"> function processData(form) { for (var i = 0; i < form.items.length; i++) { if (form.items[i].checked) { break
} } var choseItem = form.items[i].value var chosenSong = form.song.value alert("Looking to see if " + chosenSong + " was written by " + choseItem + "...") } function checkSong(songTitle) { var enteredSong = songTitle.value alert("Making sure that " + enteredSong + " was recorded by the items.") } </SCRIPT> </HEAD> <BODY> <FORM NAME="Abbey Road"> Choose your favorite Beatle: <INPUT TYPE="radio" NAME="items" VALUE="A" CHECKED="true">A <INPUT TYPE="radio" NAME="items" VALUE="B">B <INPUT TYPE="radio" NAME="items" VALUE="C">C <INPUT TYPE="radio" NAME="items" VALUE="D">D <P> Enter the name of your favorite items song:<BR> <INPUT TYPE="text" NAME="song" VALUE="value" onChange="checkSong(this)"><P> <INPUT TYPE="button" NAME="process" VALUE="Process Request..." onClick="processData(this.form)"> </FORM> </BODY> </HTML>
Related Scripts with Example Source Code in same category :