|
|
Hi,
Could someone advise me how to do the reverse values in this code? 300, 200, 100. Think I'm really hopeless when come to programming :-(
for (intIndex = 0; intIndex > ayrElements.length ;intIndex--)// this is the part that I'm stuck.
<script language="javascript">
function inspectCheckBoxes(){
var aryElements = new Array(); //Declare an Array variable
var intValue = new Number(0); //Declare a Number variable
var intIndex = new Number(0); //Declare a Number variable
//Call the getElementsByName() method which belongs to the document object.
//Provide a name of the control or HTML element that you wish the document to "find".
aryElements = document.getElementsByName("chkData");
//Use the for loop technique to loop through each element inside the Array, aryElements
for (intIndex = 0; intIndex > ayrElements.length ;intIndex--){
</script>
</head>
<body>
<table border="1">
<tr>
<td colspan="2">
<b>Experiment 1</b><br>
Experiment using JavaScript to communicate and
control the checkbox controls.</td>
</tr>
<tr>
<td style="width:10%"><input type="checkbox" name="chkData" value="100"/></td>
<td>100</td>
</tr>
<tr>
<td><input type="checkbox" name="chkData" value="200"/></td>
<td>200</td>
</tr>
<tr>
<td><input type="checkbox" name="chkData" value="300"/></td>
<td>300</td>
</tr>
<tr>
<td colspan="2">
<div id="divMessage" ></div>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="button" id="btnExperiment" value="Experiment" onclick="inspectCheckBoxes()" >
</td>
</tr>
</table>
</body>
</html>