Hi, i am writing a questionnaire in javascript to which I want to create questions that are dependent upon each other, and so are only displayed according to how a user answers a particular question. question 1 reads like this...

<div class="start" id="main">
<form name="eBayform">
<h3>1) Do you have a buyer/seller account registered with eBay?</h3>
<table class="center">
<td><input type="radio" name="account" value="buyer" onClick="onchangeQu1('both');" />
<td><input type="radio" name="account" value="seller" onClick="onchangeQu1('both');" /> Seller</td>
<td><input type="radio" name="account" value="both" onClick="onchangeQu1('both');" /> Both</td>
<td><input type="radio" name="account" value="neither" onClick="onchangeQu1('neither');" />

and the function it calls...

function onchangeQu1(theRadio, theObjectId)
theObject = document.getElementById(theObjectId);
//Remove all.
for(i=0; i<qu1.length; i++){
document.getElementById(qu1).style.display = "none";
//Display correct one


This allows the user to see the first few questions which is fine. However when the user comes to qu12 they are asked certain questions depending on whether they are buyers or sellers. As this is established in qu 1 would the best idea be to create a function that is called in the function onchnageQu1 that says something like, if radio checked equals buyer then display qu 12 etc..? I am not quite sure how to do this?


radio buttons are referenced like an array so you probably want something like

//do buyer stuff
else if(document.eBayform.account[1].checked)
//do seller stuff
else if(document.eBayform.account[2].checked)
//do both stuff
else if(document.eBayform.account[3].checked)
//do neither

is that what you are looking for?