<title></title>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
function backgorundColor(i) {
// this.document.body.style.backgroundColor = i;
// this.document.getElementById('div1').style.backgroundColor= i;
this.document.getElementsByName('div').item[0].style.backgroundColor = i;
}
function changeColor() {
var a = document.getElementsByName('color');
for (var i = 0; i < a.length; i++) {
if (allradio[i].checked == true) {
document.body.style.backgroundColor = a[i].value;
}
}
}
// $(function () {
// $('input').click(function () {
// $('body').css('background-color',$(this).attr('value'));
// })
// })
</script>
</head>
<body>
<div id="div1" style="width:200px;height:200px;"></div>
<input id="Radio1" type="radio" value="Red" name="color" οnclick="backgorundColor('Red')" /> 红色
<input id="Radio2" type="radio" value="Blue" name="color" οnclick="backgorundColor('Blue')" />蓝色
<input id="Radio3" type="radio" value="Green" name="color" οnclick="backgorundColor('Green')" />绿色
<input id="Radio4" type="radio" value="Orange" name="color" οnclick="backgorundColor('Orange')" />橙色
</body>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
function backgorundColor(i) {
// this.document.body.style.backgroundColor = i;
// this.document.getElementById('div1').style.backgroundColor= i;
this.document.getElementsByName('div').item[0].style.backgroundColor = i;
}
function changeColor() {
var a = document.getElementsByName('color');
for (var i = 0; i < a.length; i++) {
if (allradio[i].checked == true) {
document.body.style.backgroundColor = a[i].value;
}
}
}
// $(function () {
// $('input').click(function () {
// $('body').css('background-color',$(this).attr('value'));
// })
// })
</script>
</head>
<body>
<div id="div1" style="width:200px;height:200px;"></div>
<input id="Radio1" type="radio" value="Red" name="color" οnclick="backgorundColor('Red')" /> 红色
<input id="Radio2" type="radio" value="Blue" name="color" οnclick="backgorundColor('Blue')" />蓝色
<input id="Radio3" type="radio" value="Green" name="color" οnclick="backgorundColor('Green')" />绿色
<input id="Radio4" type="radio" value="Orange" name="color" οnclick="backgorundColor('Orange')" />橙色
</body>