<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>选中复选框,相关类变灰</title> <script language="JavaScript"> <!-- function selectKind(the){ var obj = the; var container = document.getElementById("kind_" + obj.name); for(var i=0;i<container.getElementsByTagName("input").length;i++) { container.getElementsByTagName("input")[i].disabled = obj.checked; }} //--> </script> </head> <body> <input type='checkbox' value="2" name=aa onclick="selectKind(this)">你从事游戏编程 <div id="kind_aa"> <input type='checkbox' value="php" name=aa>PHP <input type='checkbox' value="asp.net" name=aa>ASP.NET <input type='checkbox' value="java" name=aa>JAVA </div> <input type='checkbox' value="1" name=bb onclick="selectKind(this)">平时不上网 <div id="kind_bb"> <input type='checkbox' value="baidu.com" name=bb>baidu.com <input type='checkbox' value="163.com" name=bb>163.com <input type='checkbox' value="admin158.com" name=bb>admin158.com </div> </body> </html> |