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.len gth ;intIndex--)// this is the part that I'm stuck.
Here's the code:
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.len gth ;intIndex--)// this is the part that I'm stuck.
Here's the code:
Code:
<html>
<head>
<style>
#divMessage { width : 500px;
height : 30px;
border : 1px solid black;
}
body { font : arial;
font-size : 10px;}
</style>
<script language="javascript">
function inspectCheckBoxes(){
var aryElements = new Array();
var intValue = new Number(0);
var intIndex = new Number(0);
aryElements = document.getElementsByName("chkData");
for (intIndex= 0 ;intIndex <aryElements.length;intIndex++){
if (aryElements[intIndex].checked)
alert(aryElements[intIndex].value);
}
}
</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>
Comment