|
Hi guys,
I am trying to hide a form element with the ID "question1" and display a form element called "question2" (both of these are tables) with a link and function - but it is not working - thus: (I am getting "syntax error" in my javascript alert)
This is my link :
<a href=javascript:nextQuestion(question1, question2)>Next Question</a>
function nextQuestion(last, next){
last.style.display="none";
next.style.display="block";
}
I have tried passing the 2 elements in the brackets both with and without quotes.... can anyone please advise?
I want to use this function over and over, passing different elemnts as the quiz progresses.
Many thanks as always!!
Gonzo
|
|
|
Try this:
<script language="javascript">
function nextQuestion(last, next){
document.getElementById(last).style.display="none";
document.getElementById((next).style.display="block";
}
</script>
<a href="javascript:nextQuestion('question1', 'question2')">Next Question</a>
|
|
|
|
|
|
|
Hi troy.
many thanks
the problem was I had put a space between the 2 elements that I was passing to the function!
Gonzo
|
|
|
|
|
|
|
|