java如何获得单选按钮
jRadioButton1=newJRadioButton("d.txt",true);这一句里面的true值用什么方法得到它???什么方法??谢谢!!...
jRadioButton1 = new JRadioButton( "d.txt",true );这一句里面的true值用什么方法得到它???什么方法??谢谢!!
展开
展开全部
举个例子:
-----------------
单选按钮界面:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<script type="text/javascript">
function fn(){
for(var i=0;i<document.getElementsByName("rd").length;i++){
if(document.getElementsByName("rd")[i].checked){
var s=document.getElementsByName("rd")[i].value;
window.location.href="1.jsp?aaa="+s+"";
}
}
}
</script>
<body>
<a href="javascript:fn();">111</a>
<input type="radio" name="rd" value="java">java
<input type="radio" name="rd" value=".net">.net
</body>
</html>
---------------------
取值界面:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<body>
<%
String s=request.getParameter("aaa");
out.print(s);
%>
</body>
</html>
-----------------
单选按钮界面:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<script type="text/javascript">
function fn(){
for(var i=0;i<document.getElementsByName("rd").length;i++){
if(document.getElementsByName("rd")[i].checked){
var s=document.getElementsByName("rd")[i].value;
window.location.href="1.jsp?aaa="+s+"";
}
}
}
</script>
<body>
<a href="javascript:fn();">111</a>
<input type="radio" name="rd" value="java">java
<input type="radio" name="rd" value=".net">.net
</body>
</html>
---------------------
取值界面:
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head>
</head>
<body>
<%
String s=request.getParameter("aaa");
out.print(s);
%>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询