<html>
<head>
<title>Beatle Picker</title>
<script language="JavaScript">
function processData (form) {
for (var i = 0; i < form.Beatles.length; i++)
if (form.Beatles [i].checked) {
break
}
}
var chosenBeatle = form.Beatles[i].value
var chosenSong = form.song.value
alert ("Looking to see if " + chosenSong + " was written by chosenBeatle + "...")
}
function checkedSong (songTitle) {
var enteredSong = songTitle.value
alert ("Making sure that " + enteredSong + " was recorded by the Beatles.")
}
</script>
</head>
<body>
<form name="Abbey Road">
Выберите любимого Битла:
<input type="radio" name="Beatles" value="John Lennon" checked="true">John
<input type="radio" name="Beatles" value="Paul McCartney ">Paul
<input type="radio" name="Beatles" value="George Harrison ">George
<input type="radio" name="Beatles" value="Ringo Starr ">Ringo
<p>Введите название любимой песни Битлов:<br>
<input type="text" name="song" value="Eleanor Rigby" onChange="checkSong(this)" ><p>
<input type="button" name="process" value="Process Request..." onClick="processData(this.form)">
</form>
</body>
</html>