MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 一个关于单选按钮的有关问题,

一个关于单选按钮的有关问题,

www.MyException.Cn  网友分享于:2013-12-26  浏览:16次
一个关于单选按钮的问题,在线等~~~
两组单选按钮,每组单选按钮的数量至少3个,两组单选按钮的选择项之间存在某种相互影响关系,如在第一组中选择了某项后第二组中的某些项就不能选

假设第一组中间有三个学院   A   B   C,第二组是   a   b   c   d   e   f   g   这么多课程,假设第一组按钮中选择了A   ,则第二组按钮只能在   a   b   c   d四门课程中单选一门   请问大家怎么写程序啊   ??

------解决方案--------------------
<%@ page language= "java " pageEncoding= "GBK "%>

<%@ taglib uri= "http://struts.apache.org/tags-bean " prefix= "bean "%>
<%@ taglib uri= "http://struts.apache.org/tags-html " prefix= "html "%>
<%@ taglib uri= "http://struts.apache.org/tags-logic " prefix= "logic "%>
<%@ taglib uri= "http://struts.apache.org/tags-tiles " prefix= "tiles "%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<%@page import= "java.io.File "%>
<html:html lang= "true ">
<head>
<html:base />

<title> MyJsp.jsp </title>

<meta http-equiv= "pragma " content= "no-cache ">
<meta http-equiv= "cache-control " content= "no-cache ">
<meta http-equiv= "expires " content= "0 ">
<meta http-equiv= "keywords " content= "keyword1,keyword2,keyword3 ">
<meta http-equiv= "description " content= "This is my page ">
<!--
<link rel= "stylesheet " type= "text/css " href= "styles.css ">
-->
<script type= "text/javascript ">
function subm(value)
{
var index= " ";//设置只能选择的下标
if(value== "1 ")
{
index= "1,3,5 ";
}else if(value== "2 ")
{
index= "1,2,3 ";
}else
{
index= "4,5 ";
}
var ff=document.getElementsByName( "r2 ");
for(var i=0;i <ff.length;i++)
{
if(index.indexOf(i) <0)
{
ff[i].disabled= "disabled ";
}else
{
ff[i].disabled= " ";
}
}

}
</script>
</head>

<body> ff
<form action= "myAction.do " name= "a " >
<input type= "hidden " name= "ff ">
<input type= "radio " name= "r1 " value= "r11 " onclick= "subm( '1 '); ">
学院A
<input type= "radio " name= "r1 " value= "r12 " onclick= "subm( '2 '); " >
学院B
<input type= "radio " name= "r1 " value= "r11 " onclick= "subm( '3 '); ">
学院C
<br>
<input type= "radio " name= "r1 " value= "a " >
课程a
<input type= "radio " name= "r2 " value= "b " >
课程b
<input type= "radio " name= "r2 " value= "c ">
课程c
<input type= "radio " name= "r2 " value= "d " >
课程e
<input type= "radio " name= "r2 " value= "f " >
课程f
<input type= "radio " name= "r2 " value= "g " >
课程g
<input type= "radio " name= "r2 " value= "h ">

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有