Hi, for an assignment, we have to build a script that asks questions, mine is pretty much a, question? yes, no, format. At the moment I am trying to use the following script:
<HTML>
<HEAD>
<TITLE>Test Input </TITLE>
<HTML>
<HEAD>
<TITLE>Test Input </TITLE>
<SCRIPT LANGUAGE=”JavaScript”>
function q2(form) {
(form.inputbox.value) = “Question 2”;
}
function q3 (form) {
(form.inputbox.value) = “Question 3”;
}
function q4 (form) {
form.inputbox.value = “It worked Q4”;
}
function q5 (form) {
form.inputbox.value = “It worked Q5”;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME=”myform” ACTION=”” METHOD=”GET”>
Question <BR>
<INPUT TYPE=”text” NAME=”inputbox” VALUE=”Question 1″><P>
<INPUT TYPE=”button” NAME=”Y” Value=”Yes” onClick=”q2(this.form)”>
<INPUT TYPE=”button” NAME=”N” Value=”No” onClick=”q3(this.form)”>
</FORM>
</BODY>
</HTML>
What I want this to do is when, for example, I click yes, I want it to change the text box to the next question (i.e. (form.inputbox.value) = “Question 2″?, but, i also want the buttons to change, so the onclick fucntion points to diffrent functions (change onClick=”q2(this.form)” to onClick=”q4(this.form)”) I tried to use
function q2(form) {
(form.inputbox.value) = “Question 2”;
(form.Y.onClick) = “q3(this.form)”
}
However, it only chaned the inputbox, to “question 2”, the button did not change
Any Suggestions?