简单教程
提交运行
代码编辑器:
<script> function displayResult(browser){ document.getElementById("result").value=browser } </script> <p>选择你最喜欢的浏览器:</p> <form> <input type="radio" name="browser" onclick="displayResult(this.value)" value="Internet Explorer">Internet Explorer<br> <input type="radio" name="browser" onclick="displayResult(this.value)" value="Firefox">Firefox<br> <input type="radio" name="browser" onclick="displayResult(this.value)" value="Opera">Opera<br> <input type="radio" name="browser" onclick="displayResult(this.value)" value="Google Chrome">Google Chrome<br> <input type="radio" name="browser" onclick="displayResult(this.value)" value="Safari">Safari<br><br> 你最喜欢的浏览器是: <input type="text" id="result"> </form>
运行结果: