单选钮控制文本框

yuanhua123 2007-05-03 11:20:51
请问
<input type="radio" name="typestate" value="0">国际
<input type="radio" name="typestate" value="1" checked>国内
当我选择国际时 显示一个文本框填写,但我选择国内是,出现一个下拉菜单选择省会。选择其一时,其二就隐藏了。 请问大虾们怎么写js
...全文
200 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
rjzou2006 2007-05-05
  • 打赏
  • 举报
回复
style.display="none" or "block"

or

style.visibility='visible" or"hidden"
Dones 2007-05-04
  • 打赏
  • 举报
回复
查查 Style.display
tantaiyizu 2007-05-03
  • 打赏
  • 举报
回复
这样也行:
<div>


<input type="radio" name="t" value="0" onclick="u.style.display = '';g.style.display = 'none'">国际

<input id="u" style="display:none"> <p>



<input type="radio" name="t" value="1" onclick="g.style.display = '';u.style.display = 'none'" checked>国内

<select id="g">
<option value="">请选择</option>
</select>

<div>
tantaiyizu 2007-05-03
  • 打赏
  • 举报
回复
还可以这样:

<div>


<input type="radio" name="t" value="0" onclick="arg(this.checked,u,g)">国际

<input id="u" style="display:none"> <p>



<input type="radio" name="t" value="1" onclick="arg(this.checked,g,u)" checked>国内

<select id="g">
<option value="">请选择</option>
</select>

<div>


<script language="JavaScript">

var arg = function (tc , u_obj , g_obj){

if (tc)
{
u_obj.style.display = "" ;

g_obj.style.display = "none" ;
}

}

</script>
tantaiyizu 2007-05-03
  • 打赏
  • 举报
回复
<div>


<input type="radio" name="t" value="0" onclick="arg()">国际

<input id="u" style="display:none"> <p>



<input type="radio" name="t" value="1" onclick="arg()" checked>国内

<select id="g">
<option value="">请选择</option>
</select>

<div>


<script language="JavaScript">

var arg = function (){

if (t[0].checked)
{
u.style.display = "" ;

g.style.display = "none" ;
}
else
{
u.style.display = "none" ;

g.style.display = "" ;
}


}

</script>
hjx398 2007-05-03
  • 打赏
  • 举报
回复
分少了点,你写两个掩藏了的控件就可以了

87,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧