wantime
asked on
Javascript: transmit variable between method
hello all,
i have create a check box group, when one of them is checked, the id of this checkbox should be showed in a messagebox. The problem i met is that i don't know how to transmit the id between the method.
following are the source codes.
any suggestion?
thanks.
wantime
i have create a check box group, when one of them is checked, the id of this checkbox should be showed in a messagebox. The problem i met is that i don't know how to transmit the id between the method.
following are the source codes.
any suggestion?
thanks.
wantime
<html>
<head>
<script language="JavaScript">
function cbVariableTest() {
var mTable = document.getElementById('dy');
for (var i = 0; i < 3; i++) {
row = mTable.insertRow(-1);
cb = row.insertCell(0);
cb.innerHTML = '<input type="checkbox" id = i checked onclick="checkIt(i);"></input>';
}
}
function checkIt(checkBoxId) {
alert('CheckBox Id is: ' + checkBoxId);
}
</script>
</script>
</head>
<body>
<table id="dy">
</table>
<input type="button" value = "Create CheckBox Group" onclick="cbVariableTest()"/>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.