-
-
Save jpfinley/469489 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<script language="javascript" type="text/javascript"> | |
//<![CDATA[ | |
function getCount(){ | |
removeAllAnswers(); | |
var answerCount = document.getElementById("jsSelecter").value; | |
for (var i=0; i < answerCount; i++){ | |
insertAnswer(); | |
}; | |
} | |
function removeAllAnswers(){ | |
var list = document.getElementById("answer-list"); | |
if(list.hasChildNodes()){ | |
while (list.childNodes.length >= 1){ | |
list.removeChild(list.firstChild); | |
} | |
} | |
} | |
function insertAnswer(){ | |
var list = document.getElementById("answer-list"); | |
var li = document.createElement("li"); | |
for (var i=1; i<=6;i++) { | |
var txt = ("Question " + i); | |
}; | |
var newtext = document.createTextNode(txt); | |
document.answer-list.appendChild(newtext); | |
var input = document.createElement("input"); | |
input.id = "1"; | |
input.name = "1"; | |
input.type = "text"; | |
li.appendChild(input); | |
list.appendChild(li); | |
} | |
//]]> | |
</script> | |
</head> | |
<body> | |
<p> | |
How many Answers Are needed? <select id="jsSelecter" onchange="getCount();"> | |
<option selected="selected" value=""> | |
- | |
</option> | |
<option value="2"> | |
2 | |
</option> | |
<option value="3"> | |
3 | |
</option> | |
<option value="4"> | |
4 | |
</option> | |
<option value="5"> | |
5 | |
</option> | |
<option value="6"> | |
6 | |
</option> | |
</select><br /> | |
</p> | |
<ul id="answer-list"> | |
<li style="list-style: none">Question 1<br /> | |
</li> | |
<li> | |
<input id="1" name="1" type="text" /> | |
</li> | |
<li style="list-style: none">Question 2<br /> | |
</li> | |
<li> | |
<input id="1" name="1" type="text" /> | |
</li> | |
</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment