Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Make this script display multiple options?

basically I want it to have a list of check boxes. When for example check box 1 is clicked then show question one (whats below). However, I also need this script to be able to display multiple questions at a time. Right now even if I change the variables the script will only show the question closest to the end of the code. The code is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona...

<html xmlns="http://www.w3.org/1999/xhtml%22%3E

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Political Decision Engine</title>

<style>

* {

margin: 0;

padding: 0;

}

html {

font: 16px "Segoe UI", "Segoe WPC", Helvetica, Arial, "Arial Unicode MS", Sans-Serif;

}

div {

float: left;

}

</style>

</head>

<body>

<form action="" method="post" name="question1" target="_self">

<table border="1">

<th colspan="2" align="center" bgcolor="#FF9900">

Political Decision Engine

</th>

<tr>

<td bgcolor="#F5D69A">

Question one:

</td>

<td rowspan="4" width="150" bgcolor="#F4DA88">

Image goes here

</td>

</tr>

<tr>

<td bgcolor="#F5E8CB">

<table border="1">

<tr>

<td width="100"><input type="radio" id="option_1" name="question_1" onclick="reportValue(this)" /> Option 1 </td>

<td width="100"><input type="radio" id="option_2" name="question_1" onclick="reportValue(this)" /> Option 2 </td>

<td width="100"><input type="radio" id="option_3" name="question_1" onclick="reportValue(this)" /> Option 3 </td>

<td width="100"><input type="radio" id="option_4" name="question_1" onclick="reportValue(this)" /> Option 4 </td>

<td width="100"><input type="radio" id="option_5" name="question_1" onclick="reportValue(this)" /> Option 5 </td>

</tr>

</table></td>

</tr>

<tr>

<td bgcolor="#F5E8CB">

<script>

function reportValue(element){

var result_Element = document.getElementById("result");

if (element.id == "option_1"){

result_Element.innerHTML = "Enter text for Option 1.";

} else if (element.id == "option_2"){

result_Element.innerHTML = "Enter text for Option 2.";

} else if (element.id == "option_3"){

result_Element.innerHTML = "Enter text for Option 3.";

} else if (element.id == "option_4"){

result_Element.innerHTML = "Enter text for Option 4.";

} else if (element.id == "option_5"){

result_Element.innerHTML = "Enter text for Option 5.";

}

}

</script>

<p id="result">Please select a choice</p>

</td>

</tr>

<tr>

<td bgcolor="#F5E8CB">

Resourses

</td>

</tr>

</table>

</body>

</html>

1 Answer

Relevance
Still have questions? Get your answers by asking now.