<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <script language="javascript"> function chclick(){ sText=""; for(i=0;i<document.form1.ch1.length;i++){ if(document.form1.ch1[i].checked==true){ sText+=document.form1.ch1[i].value+","; } } document.form1.text1.value=sText; } </script>
<body> <form name="form1"> <p><input type="checkbox" name="ch1" value="上网" onClick="chclick()">上网</p> <p><input type="checkbox" name="ch1" value="打球" onClick="chclick()">打球</p> <p><input type="checkbox" name="ch1" value="听音乐" onClick="chclick()">听音乐</p> <p><input type="checkbox" name="ch1" value="看电视" onClick="chclick()">看电视</p> <p> <textarea name="text1"></textarea> </p> </form> </body> </html>