想在进入页面时RADIO按钮就生效,怎么做?
也就是说,在我刷新页面时,打印出 "upper ".
<HTML>
<HEAD>
<TITLE> Radio </TITLE>
</HEAD>
<script language= "javascript " type= "text/javascript ">
function upper() { alert( "upper ");}
function lower() { alert( "lower ");}
</SCRIPT>
<BODY>
<FORM NAME= "form1 ">
<P> <B> transfer: </B> <BR> <INPUT TYPE= "radio " NAME= "conversion " VALUE= "upper " checked= "checked "
onClick= "upper() "> upper
<BR> <INPUT TYPE= "radio " NAME= "conversion " VALUE= "lower "
onClick= "lower() "> lower
</FORM>
</body>
</html>
因为确定了upper是初始选定的 "checked ",想要在刷新时就可以有输出.
谢谢大家帮忙.
------解决方案-------------------- <HTML>
<HEAD>
<TITLE> Radio </TITLE>
</HEAD>
<script language= "javascript " type= "text/javascript ">
function check()
{
if(document.form1.conversion[0].checked)
{
alert( "upper ");
}
if(document.form1.conversion[1].checked)
{
alert( "lower ");
}
}
</SCRIPT>
<BODY onload= "check() ">
<FORM NAME= "form1 " >
<P> <B> transfer: </B> <BR> <INPUT TYPE= "radio " NAME= "conversion " VALUE= "upper " checked= "checked " onClick= "check() "> upper
<BR> <INPUT TYPE= "radio " NAME= "conversion " VALUE= "lower " onClick= "check() "> lower
</FORM>
</body>
</html>
不知道这样写是不是合你的意思``功能是实现了。