"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Alain Dhaene wrote on 06 jan 2004 in comp.lang.javascript:
ctrl = "control" + 5;
if(tekst=='good')
{
document.formname.ctrl .checked = true;
}
document.formname[ctrl].checked
?
================
more consize, also unchecks:
document.formname["control"+5].checked=(tekst=='good')
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Perhaps?
<html>
<head>
<title>control5.htm</title>
<script language="javascript" type="text/javascript">
<!--
function evaluate(tekst) {
var form = document.forms[0];
var ctrl;
ctrl = eval("form.control" + 5);
if (tekst=='good') {
ctrl.checked = true;
}
}
// -->
</script>
</head>
<body>
<form>
<input type="checkbox" name="control5">
<input type="button" value="check" onclick="evaluate('good')">
</form>
</body>
</html>