2011-03-22 67 views
0

我是javascript中的新手。 我有一个textBoxradioButton。 如果我点击文本框radioButton应该被点击。 任何这个例子?javascript in radio button

+0

你想单选按钮即可选择(这是未选择的最初)文本框被点击或获得焦点的时候? – Kushal 2011-03-22 08:33:11

回答

2

这应该做的工作:

<html> 
<head> 
<script type="text/javascript"> 
function boo() 
{ 
document.all.myRadioButton1.checked = true; 

} 
</script> 
</head> 
<body> 
<input type="text" value="some text" onclick="boo()"> 
<input type="radio" id="myRadioButton1"> 
</body> 
</html>