-
A simple VBScript error
Code:
<html><head><title>Testing, will it work??? Probalbly not!</title></head>
<BODY>
<H1>Welcome to the Visual Basic Quiz!</h1>
Please make a choice by Clciking the appropriate answer<p><br>
What does Stephen Hawking do for a living?<p>
<form name="frm">
<input type="radio" NAME="radq1" CHECKED> Engineer<BR>
<input type="radio" NAME="radq1"> Physisist<BR>
<input type="radio" NAME="radq1"> Accountant<BR>
<input type="radio" NAME="radq1"> Unemployed<BR><br><p>
<input type="button" NAME="B1" Value = "Click to check your answer!"><p>
<INPUT TYPE="text" NAME="txtMsg" Size="50"><p></form>
<SCRIPT LANGUAGE="VBS">
Dim NumGos
Sub b1_Onclick
NumGos = Numgos + 1
if frm.radq1.item(1).checked then
frm.txmsg.value = "Well done! You are right after" & Cstr(NumGos)
if numgos = 1 then
frm.txmsg.value = frm.txmsg.value & "Try"
else
frm.txmsg.value = frm.txmsg.value & "Tries"
end if
if numgos = 2 then
msgbox("Right First Time - Ya lucky git!")
end if
else
frm txmsg.value = "Wrong, ya DUMB ass!"
end if
End Sub
</SCRIPT>
</BODY></HTML>
thats it, and it dont work, just get an error in the status bar that says error on page!
-
Well, I do all of my client side stuff in JavaScript, so I haven't got a care, but..
That line is missing a dot.
-
if your talking about the
frm txmsg.value = "Wrong, ya DUMB ass!"
then it didnt work putting a . inbetweeb the from txmsg
but it does need ot be there so thanx, still an error though :(
-
You mis-spelled the name of your textbox nearly everywhere.
-
and
msgbox("Right First Time - Ya lucky git!")
should be msgbox "Right First Time - Ya lucky git!"
No "(" & ")"
If you want "(" ..
X = msgbox("Are you sure?" ,vbyesno + vbquestion,"Question")
if x = vbyes then
Msgbox "yes"
else
msgobx "no"
end if
-
For that matter, you shouldn't be using Msgbox on a web page at all.. there is a whole other thread on this topic, but suffice to say you should be using:
window.alert "blahblahblah"