fucction check1(){
应为
function check1(){
应为
function check1(){
解决方案 »
- input的onfocus事件
- jQuery给事件绑函数,如何传入参数呢?
- extjs 消息: 'this.config[...].sortable' 为空或不是对象.要怎么处理?
- jquery循环添加事件的问题
- 怎么让链接先执行onclick后再跳转呢
- 一个比较复杂的JVASCRIPT问题. 高分求救!!!!
- 求关于javascript访问XML方面的帮助文件(手册),越详细越好(急!送高分!)
- ####javascript调试的菜鸟问题,马上给分####
- 大家帮忙看看这个菜单是怎么实现的
- jquery 产生不重复的随机数
- 怎样将<form>提交页面指向showModalDialog打开的窗口中?
- 我想在网页中加入索引,点击后网页中的相关内容显示出来。请问如何实现????
应为
var CateCode=[];
for(int i=0;i<2;i++){
应为
for(var i=0;i<2;i++){
<html>
<head>
<title>
CategoryEmail
</title>
</head>
<body>
<script language=javascript>
function checkAll(){
if(document.form1.checkboxAll.checked ==true){
check1();
check2();
}
}
function check1(){
document.form1.checkbox1.checked =true;
}
function check2(){
document.form1.checkbox2.checked =true;
}function getCateCode( ){
var CateCode=[];
if(document.form1.checkbox1.checked==true)
CateCode[0] = "A001";
if(document.form1.checkbox2.checked==true)
CateCode[1] = "A002";
for(var i=0;i<2;i++){
if(CateCode[i]!=null){
window.prompt("CateCode[i] is "+CateCode[i]);
}
}
return CateCode;
} function subDelectAll(){
getCateCode();
document.form1.submit();
}</script>
<h1>
THIS IS MY TEST!
</h1>
<form name="form1" method="post" action="Jsp2.jsp">
<table border="1" width="80%" cellpadding="0" cellspacing="0" >
<table border="1" width="80" >
<tr >
<td width="70%">
<input type="checkbox" name="checkboxAll" onclick="checkAll()">Check All
</td>
<td width="30%">
<input type="submit" name="DelectAll" value ="DelectAll" onclick="subDelectAll()">
</tr>
</table>
<table border="1" width="80%" cellpadding="0" cellspacing="0">
<tr bgcolor ="yellow"> <td width="4%"> </td>
<td width="16%"> <div align="center">CategoryCode</div>
</td> <td width="80%">
<div align="left">Description</div>
</td> </tr>
<tr border="1" width="100%" cellpadding="0" cellspacing="0" >
<td width="4%">
<input type="checkbox" name="checkbox1" value="checkbox1" onclick="check1()">
</td>
<td align="center" width="16%">AOO1</td>
<td align="left" width="80%" class="FontUnderLine">America </td>
</tr>
<tr>
<td width="4%">
<input type="checkbox" name="checkbox2" value="checkbox2" onclick="check2()">
</td>
<td align="center" width="16%">A002</td>
<td align="left" width="80%" class="FontUnderLine">Europe</td>
</tr>
</table>
</table>
</form>
</body>
</html>1.选完不能撤销不选
2.prompt有什么用?
<head>
<title>
CategoryEmail
</title>
</head>
<body>
<script language="javascript">
function checkAll(){
if(document.form1.checkAllbox.checked){
check1();
check2();
}
else
{
document.form1.checkbox1.checked =false;
document.form1.checkbox2.checked =false;
}
}
function check1(){
document.form1.checkbox1.checked =true;
}
function check2(){
document.form1.checkbox2.checked =true;
}function getCateCode(){
var CateCode = new Array("","");
if(document.form1.checkbox1.checked==true)
CateCode[0] = "A001";
if(document.form1.checkbox2.checked==true)
CateCode[1] = "A002";
for(var i=0;i<2;i++){
if(CateCode[i]!=null){
window.prompt("CateCode[i] is "+CateCode[i]);
}
}
return CateCode;
} function subDelectAll(){
getCateCode();
document.form1.submit();
}</script>
<h1>
THIS IS MY TEST!
</h1>
<form name="form1" method="post" action="Jsp2.jsp">
<table border="1" width="80%" cellpadding="0" cellspacing="0" >
<tr >
<td width="70%">
<input type="checkbox" name="checkAllbox" onclick="checkAll()">Check All
</td>
<td width="30%">
<input type="submit" name="DelectAll" value="DelectAll" onclick="subDelectAll()">
</tr>
</table>
<table border="1" width="80%" cellpadding="0" cellspacing="0">
<tr bgcolor ="yellow"> <td width="4%"> </td>
<td width="16%"> <div align="center">CategoryCode</div>
</td> <td width="80%">
<div align="left">Description</div>
</td> </tr>
<tr border="1" width="100%" cellpadding="0" cellspacing="0" >
<td width="4%">
<input type="checkbox" name="checkbox1" value="checkbox1" onclick="check1()">
</td>
<td align="center" width="16%">AOO1</td>
<td align="left" width="80%" class="FontUnderLine">America </td>
</tr>
<tr>
<td width="4%">
<input type="checkbox" name="checkbox2" value="checkbox2" onclick="check2()">
</td>
<td align="center" width="16%">A002</td>
<td align="left" width="80%" class="FontUnderLine">Europe</td>
</tr>
</table>
</form>
</body>
</html>
<html>
<head>
<title>
CategoryEmail
</title>
</head>
<body>
<script language=javascript>
function checkAll(){
if(document.form1.checkboxAll.checked ==true){
check1();
check2();
}
}
function check1(){
document.form1.checkbox1.checked =true;
}
function check2(){
document.form1.checkbox2.checked =true;
}function getCateCode( ){
var CateCode=[];
if(document.form1.checkbox1.checked==true)
CateCode[0] = "A001";
if(document.form1.checkbox2.checked==true)
CateCode[1] = "A002";
for(var i=0;i<2;i++){
if(CateCode[i]!=null){
window.prompt("CateCode[i] is "+CateCode[i]);
}
}
return CateCode;
} function subDelectAll(){
getCateCode();
document.form1.submit();
}</script>
<h1>
THIS IS MY TEST!
</h1>
<form name="form1" method="post" action="Jsp2.jsp">
<table border="1" width="80%" cellpadding="0" cellspacing="0" >
<table border="1" width="80" >
<tr >
<td width="70%">
<input type="checkbox" name="checkboxAll" onclick="checkAll()">Check All
</td>
<td width="30%">
<input type="submit" name="DelectAll" value ="DelectAll" onclick="subDelectAll()">
</tr>
</table>
<table border="1" width="80%" cellpadding="0" cellspacing="0">
<tr bgcolor ="yellow"> <td width="4%"> </td>
<td width="16%"> <div align="center">CategoryCode</div>
</td> <td width="80%">
<div align="left">Description</div>
</td> </tr>
<tr border="1" width="100%" cellpadding="0" cellspacing="0" >
<td width="4%">
<input type="checkbox" name="checkbox1" value="checkbox1">
</td>
<td align="center" width="16%">AOO1</td>
<td align="left" width="80%" class="FontUnderLine">America </td>
</tr>
<tr>
<td width="4%">
<input type="checkbox" name="checkbox2" value="checkbox2" >
</td>
<td align="center" width="16%">A002</td>
<td align="left" width="80%" class="FontUnderLine">Europe</td>
</tr>
</table>
</table>
</form>
</body>
</html>
功能是实现了,可为什么我第二次点击Check All时,下面两个小方框的√还在,应该是也谁之取消的才对呀!有没有改进的方法!
var flag=document.form1.checkboxAll.checked
document.form1.checkbox1.checked =flag;
document.form1.checkbox1.checked =flag;
}
你的程序是非常正确的,但也是在我第二次点击[]Check All时,下面两个[√]Check1和[√]Check2里的√也是还在呀。