What my question is, is that how can I get it so that when user submits value in the other table that the spinner buttons are also displayed in the other table so that except the value is in a textbox, it is displayed in a spinner which operates exactly the same as the spinner in the previous table?
Below is code where the value from the first spinner is retireved and oututted into another table into a textbox:
Code: Select all
function insertQuestion(form) {
var row = document.createElement("tr");
var cell,
input,
alertErrors = "",
qnum = 1;
cell = document.createElement("td");
cell.className = "weight";
input = document.createElement("input");
input.name = "weight_" + qnum;
input.onkeypress = "return isNumberKey(event)";
input.value = form.textWeight.value;
cell.appendChild(input);
row.appendChild(cell);
document.getElementById("qandatbl").appendChild(row);
}Code: Select all
<form id="enter" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" onsubmit="return validateForm(this);" >
<div id="detailsBlock">
<table id="answerWeight">
<tr>
<th colspan="3">
Answer Weight
</th>
</tr>
<tr>
<td class="spinner">Weight: <input type="text" class="spinnerWeight" name="textWeight" id="txtWeight" />%</td>
<td><button class="scrollBtn" id="btnWeightUp" type="button"><img src="Images/black_uppointing_triangle.png" alt="Increase" /></button>
<button class="scrollBtn" id="btnWeightDown" type="button"><img src="Images/black_downpointing_triangle.png" alt="Decrease" /></button></td>
</tr>
</table>
<table id="questionBtn" align="center">
<tr>
<th>
<input id="addQuestionBtn" name="addQuestion" type="button" value="Add Question" onClick="insertQuestion(this.form)" />
</th>
</tr>
</table>
</div>
<hr/>
<table id="qandatbl" border="1">
<tr>
<th class="qid">Question No</th>
<th class="question">Question</th>
<th class="option">Option Type</th>
<th class="answer">Answer</th>
<th class="weight">Weight</th>
</tr>
</table>
</form>