<input type = "button" value = " modify gender" the above mentioned id = "btn14">
<input type = "radio" name = "sex" value = "1"> M
<input type = "radio" name = "sex" value = "2" id = " rad1"> M
<Script type = "text / JavaScript">
function My $ (ID) {
return document.getElementById (ID);
}
// rule: in the form tag, and if the property only one value, and the value of this property is itself
// (for example, a radio button is selected by default: the checked = "the checked")
// so, write js code, DOM operation, when the property value is a Boolean type on it
my $ ( "btn14").onclick = function() {
my$("rad1").checked = true;
};
</script>
<br />
<input type="button" value="选择兴趣" id="btn15" />
<input type="checkbox" name="xingqu" value="1" />吃饭
<input type="checkbox" name="xingqu" value="2" id="a"/>睡觉
<input type="checkbox" name="xingqu" value="3" />打豆豆
<input type="checkbox" name="xingqu" value="4" id="b"/>唱歌
<script type="text/javascript">
my$("btn15").onclick =function(){
my$("a").checked=true;
my$("b").checked=true;
};
</script>