您的位置:首页 > Web前端 > HTML

HTML DOM 多想单选时 显示选定的值

2016-05-15 16:56 267 查看
<html>

<head>

<script type="text/javascript">

function check(browser)

  {

  document.getElementById("answer").value=browser

  }

</script>

</head>

<body>

<p>您喜欢哪款浏览器?</p>

<form>

<input type="radio" name="browser" onclick="check(this.value)" value="Internet Explorer">Internet Explorer<br />

<input type="radio" name="browser" onclick="check(this.value)" value="Firefox">Firefox<br />

<input type="radio" name="browser" onclick="check(this.value)" value="Netscape">Netscape<br />

<input type="radio" name="browser" onclick="check(this.value)" value="Opera">Opera<br />

<br />

您喜欢的浏览器是:<input type="text" id="answer" size="30">

</form>

</body>
</html>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: