C
chris962
I have very basic knowledge of Javascript and am trying to get a web
page to play one of two different sound files based on whether the user
has correctly guessed a number.
At the moment, all I can make it do is display an alert.
If anyone can help with this I would really appreciate it.
Chris
This is what I've got so far (correct number is 6):
<head>
<script language="JavaScript" TYPE="TEXT/JAVASCRIPT">
function validForm(PassForm) {
if (PassForm.passwd1.value == "") {
alert("No value entered")
playsound('sound.wav')
PassForm.passwd1.focus()
return false
}
if (PassForm.passwd1.value == "6") {
alert("********* Correct number *********")
playsound('\\Poweredge\Intranet_Live\winner.mp3')
PassForm.passwd1.focus()
return true
}
if (PassForm.passwd1.value != "6") {
alert("Wrong number")
playsound('\\Poweredge\Intranet_Live\wrong.mp3')
PassForm.passwd1.focus()
return false
}
return true
}
</script>
</head>
<body>
ENTER YOUR GUESS HERE:
<form method=Get enctype="application/x-www-form-urlencoded"
onSubmit="return validForm(this)">
<p class=MsoNormal><INPUT TYPE="TEXT" NAME="passwd1"><INPUT
TYPE="SUBMIT" VALUE="Go!"> <INPUT TYPE="RESET">
</p>
</form>
</body>
page to play one of two different sound files based on whether the user
has correctly guessed a number.
At the moment, all I can make it do is display an alert.
If anyone can help with this I would really appreciate it.
Chris
This is what I've got so far (correct number is 6):
<head>
<script language="JavaScript" TYPE="TEXT/JAVASCRIPT">
function validForm(PassForm) {
if (PassForm.passwd1.value == "") {
alert("No value entered")
playsound('sound.wav')
PassForm.passwd1.focus()
return false
}
if (PassForm.passwd1.value == "6") {
alert("********* Correct number *********")
playsound('\\Poweredge\Intranet_Live\winner.mp3')
PassForm.passwd1.focus()
return true
}
if (PassForm.passwd1.value != "6") {
alert("Wrong number")
playsound('\\Poweredge\Intranet_Live\wrong.mp3')
PassForm.passwd1.focus()
return false
}
return true
}
</script>
</head>
<body>
ENTER YOUR GUESS HERE:
<form method=Get enctype="application/x-www-form-urlencoded"
onSubmit="return validForm(this)">
<p class=MsoNormal><INPUT TYPE="TEXT" NAME="passwd1"><INPUT
TYPE="SUBMIT" VALUE="Go!"> <INPUT TYPE="RESET">
</p>
</form>
</body>