复选框 复选多个 不弹出网页
时间:2010-05-10
来源:互联网
不知道为什么,我做的搜索复选框,选多个他只弹出多项选中项的第一个,
哪位大虾帮帮忙.,.
页面代码:
哪位大虾帮帮忙.,.
页面代码:
复制内容到剪贴板
<script language="JavaScript" src="js/checkbox.js"></script>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td style="padding-left:115px; padding-right:60px;">
<form name="Searchform" onSubmit="return(search())" class="Searchform">
<div align="center" style="float:left;"><input type="text" name="key" size="80" onMouseOver="this.focus()" onFocus="this.select()" class="Search" /></div><div style="float:left;"><input type="image" src="img/SearchSubmit.jpg" value="SearchSubmit" name="SearchSubmit" id="SearchSubmit" /></div>
</td></tr>
<tr><td>
<label class="cbox"><input name="No1" type="radio" class="checkbox" value="百度" checked="checked"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a onClick="selectcheckbox()" class="checkbox_a" style="cursor:hand">百度</a>
<label class="cbox"><input name="No14" type="checkbox" class="checkbox" value="谷歌"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.google.com/"class="checkbox_a" target="_black">谷歌</a>
<label class="cbox"><input name="No2" type="checkbox" class="checkbox" value="音乐"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.mp3.baidu.com/"class="checkbox_a" target="_black">音乐</a>
<label class="cbox"><input name="No3" type="checkbox" class="checkbox" value="爱拍"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.aipai.com/"class="checkbox_a" target="_black">爱拍</a>
<label class="cbox"><input name="No7" type="checkbox" class="checkbox" value="知道"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://zhidao.baidu.com/"class="checkbox_a" target="_black">知道</a>
<label class="cbox"><input name="No13" type="checkbox" class="checkbox" value="搜搜"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.soso.com/"class="checkbox_a" target="_black">搜搜</a>
<label class="cbox"><input name="No5" type="checkbox" class="checkbox" value="图片"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://image.baidu.com/"class="checkbox_a" target="_black">图片</a>
<label class="cbox"><input name="No10" type="checkbox" class="checkbox" value="狗狗"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.gougou.cn/"class="checkbox_a" target="_black">狗狗</a>
<label class="cbox"><input name="No6" type="checkbox" class="checkbox" value="贴吧"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://post.baidu.com/"class="checkbox_a" target="_black">贴吧</a>
<label class="cbox"><input name="No8" type="checkbox" class="checkbox" value="视频"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.tudou.com/"class="checkbox_a" target="_black">土豆</a>
<label class="cbox"><input name="No9" type="checkbox" class="checkbox" value="快播"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.qvod.cn/"class="checkbox_a" target="_black">快播</a>
<label class="cbox"><input name="No4" type="checkbox" class="checkbox" value="翻译"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://translate.google.cn/"class="checkbox_a" target="_black">翻译</a>
<label class="cbox"><input name="No11" type="checkbox" class="checkbox" value="多特"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.duote.com/"class="checkbox_a" target="_black">多特</a>
<label class="cbox"><input name="No12" type="checkbox" class="checkbox" value="天空"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.skycn.com/"class="checkbox_a" target="_black">天空</a>
</form>
</td></tr>
</table>
search.js代码:
代码:
<script language="JavaScript" src="js/search.js"></script><script language="JavaScript" src="js/checkbox.js"></script>
<table width="850" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td style="padding-left:115px; padding-right:60px;">
<form name="Searchform" onSubmit="return(search())" class="Searchform">
<div align="center" style="float:left;"><input type="text" name="key" size="80" onMouseOver="this.focus()" onFocus="this.select()" class="Search" /></div><div style="float:left;"><input type="image" src="img/SearchSubmit.jpg" value="SearchSubmit" name="SearchSubmit" id="SearchSubmit" /></div>
</td></tr>
<tr><td>
<label class="cbox"><input name="No1" type="radio" class="checkbox" value="百度" checked="checked"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a onClick="selectcheckbox()" class="checkbox_a" style="cursor:hand">百度</a>
<label class="cbox"><input name="No14" type="checkbox" class="checkbox" value="谷歌"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.google.com/"class="checkbox_a" target="_black">谷歌</a>
<label class="cbox"><input name="No2" type="checkbox" class="checkbox" value="音乐"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.mp3.baidu.com/"class="checkbox_a" target="_black">音乐</a>
<label class="cbox"><input name="No3" type="checkbox" class="checkbox" value="爱拍"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.aipai.com/"class="checkbox_a" target="_black">爱拍</a>
<label class="cbox"><input name="No7" type="checkbox" class="checkbox" value="知道"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://zhidao.baidu.com/"class="checkbox_a" target="_black">知道</a>
<label class="cbox"><input name="No13" type="checkbox" class="checkbox" value="搜搜"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.soso.com/"class="checkbox_a" target="_black">搜搜</a>
<label class="cbox"><input name="No5" type="checkbox" class="checkbox" value="图片"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://image.baidu.com/"class="checkbox_a" target="_black">图片</a>
<label class="cbox"><input name="No10" type="checkbox" class="checkbox" value="狗狗"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.gougou.cn/"class="checkbox_a" target="_black">狗狗</a>
<label class="cbox"><input name="No6" type="checkbox" class="checkbox" value="贴吧"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://post.baidu.com/"class="checkbox_a" target="_black">贴吧</a>
<label class="cbox"><input name="No8" type="checkbox" class="checkbox" value="视频"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.tudou.com/"class="checkbox_a" target="_black">土豆</a>
<label class="cbox"><input name="No9" type="checkbox" class="checkbox" value="快播"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.qvod.cn/"class="checkbox_a" target="_black">快播</a>
<label class="cbox"><input name="No4" type="checkbox" class="checkbox" value="翻译"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://translate.google.cn/"class="checkbox_a" target="_black">翻译</a>
<label class="cbox"><input name="No11" type="checkbox" class="checkbox" value="多特"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.duote.com/"class="checkbox_a" target="_black">多特</a>
<label class="cbox"><input name="No12" type="checkbox" class="checkbox" value="天空"><img src="http://www.moonless.net/demo/11/4.gif" /></label>
<a href="http://www.skycn.com/"class="checkbox_a" target="_black">天空</a>
</form>
</td></tr>
</table>
复制内容到剪贴板
{
if(Searchform.No1.checked)
window.open("http://www.baidu.com/s?tn=sitehao123&word="+Searchform.key.value,"Searchwww1");
if(Searchform.No2.checked)
window.open("http://mp3search.baidu.com/wstsearch?tn=baidump3&ct=134217728&lm=-1&rn=&word="+Searchform.key.value,"Searchwww2");
if(Searchform.No3.checked)
window.open("http://so.aipai.com/search?type=card&key="+Searchform.key.value,"Searchwww3");
if(Searchform.No4.checked)
window.open("http://translate.google.cn/#en|zh-CN|"+Searchform.key.value,"Searchwww4");
if(Searchform.No5.checked)
window.open("http://www.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&word="+Searchform.key.value,"Searchwww5");
if(Searchform.No6.checked)
window.open("http://post.baidu.com/f?kw="+Searchform.key.value,"Searchwww6");
if(Searchform.No7.checked)
window.open("http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word="+Searchform.key.value,"Searchwww7");
if(Searchform.No8.checked)
window.open("http://so.tudou.com/isearch/"+Searchform.key.value,"Searchwww8");
if(Searchform.No9.checked)
window.open("http://www.jndngzs.com/qvod/so_new.asp?k="+Searchform.key.value,"Searchwww9");
if(Searchform.No10.checked)
window.open("http://www.gougou.com/search?search="+Searchform.key.value,"Searchwww10");
if(Searchform.No11.checked)
window.open("http://duote.com/search.php?searchType=&so="+Searchform.key.value,"Searchwww11");
if(Searchform.No12.checked)
window.open("http://www.skycn.com/search.php?ss_name="+Searchform.key.value,"Searchwww12");
if(Searchform.No13.checked)
window.open("http://www.soso.com/q?&w="+Searchform.key.value,"Searchwww13");
if(Searchform.No14.checked)
window.open("http://www.google.com.hk/search?hl=zh-CN&q="+Searchform.key.value,"Searchwww14");
return false;
}
checkbox.js代码:
代码:
function search(){
if(Searchform.No1.checked)
window.open("http://www.baidu.com/s?tn=sitehao123&word="+Searchform.key.value,"Searchwww1");
if(Searchform.No2.checked)
window.open("http://mp3search.baidu.com/wstsearch?tn=baidump3&ct=134217728&lm=-1&rn=&word="+Searchform.key.value,"Searchwww2");
if(Searchform.No3.checked)
window.open("http://so.aipai.com/search?type=card&key="+Searchform.key.value,"Searchwww3");
if(Searchform.No4.checked)
window.open("http://translate.google.cn/#en|zh-CN|"+Searchform.key.value,"Searchwww4");
if(Searchform.No5.checked)
window.open("http://www.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&word="+Searchform.key.value,"Searchwww5");
if(Searchform.No6.checked)
window.open("http://post.baidu.com/f?kw="+Searchform.key.value,"Searchwww6");
if(Searchform.No7.checked)
window.open("http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word="+Searchform.key.value,"Searchwww7");
if(Searchform.No8.checked)
window.open("http://so.tudou.com/isearch/"+Searchform.key.value,"Searchwww8");
if(Searchform.No9.checked)
window.open("http://www.jndngzs.com/qvod/so_new.asp?k="+Searchform.key.value,"Searchwww9");
if(Searchform.No10.checked)
window.open("http://www.gougou.com/search?search="+Searchform.key.value,"Searchwww10");
if(Searchform.No11.checked)
window.open("http://duote.com/search.php?searchType=&so="+Searchform.key.value,"Searchwww11");
if(Searchform.No12.checked)
window.open("http://www.skycn.com/search.php?ss_name="+Searchform.key.value,"Searchwww12");
if(Searchform.No13.checked)
window.open("http://www.soso.com/q?&w="+Searchform.key.value,"Searchwww13");
if(Searchform.No14.checked)
window.open("http://www.google.com.hk/search?hl=zh-CN&q="+Searchform.key.value,"Searchwww14");
return false;
}
复制内容到剪贴板
var cname = "cbox";
var delay = 50;
var labs = document.getElementsByTagName("label");
for(var key in labs) {
if(labs[key].className!=cname)
continue;
var ipt = labs[key].getElementsByTagName("input")[0];
var pic = labs[key].getElementsByTagName("img")[0];
pic.style.position="static";
pic.style.display="inline";
pic.style.background="url(./img/5.gif) no-repeat 0 0";
ipt.style.position="absolute";
ipt.style.display="none";
//s1
pic.src=(ipt.checked)?"./img/3.gif":"./img/4.gif";
//s2
labs[key].onmouseover=function(){
var mypic = this.getElementsByTagName("img")[0];
setTimeout(function(){mypic.style.backgroundPosition="0 -28px";},delay/2);
setTimeout(function(){mypic.style.backgroundPosition="0 -14px";},delay);
}
labs[key].onmouseout=function(){
var mypic = this.getElementsByTagName("img")[0];
setTimeout(function(){mypic.style.backgroundPosition="0 -28px";},delay);
setTimeout(function(){mypic.style.backgroundPosition="0 0";},delay*2);
}
labs[key].onclick=function(){
var myipt = this.getElementsByTagName("input")[0];
var mypic = this.getElementsByTagName("img")[0];
if(myipt.checked)
myipt.checked=false;
else
myipt.checked=true;
mypic.src=(myipt.checked)?"./img/3.gif":"./img/4.gif";
}
}
}
if(window.attachEvent) {
window.attachEvent("onload", mycbox);
}
else if(window.addEventListener) {
window.addEventListener('DOMContentLoaded', mycbox, false);
}
代码:
function mycbox() {var cname = "cbox";
var delay = 50;
var labs = document.getElementsByTagName("label");
for(var key in labs) {
if(labs[key].className!=cname)
continue;
var ipt = labs[key].getElementsByTagName("input")[0];
var pic = labs[key].getElementsByTagName("img")[0];
pic.style.position="static";
pic.style.display="inline";
pic.style.background="url(./img/5.gif) no-repeat 0 0";
ipt.style.position="absolute";
ipt.style.display="none";
//s1
pic.src=(ipt.checked)?"./img/3.gif":"./img/4.gif";
//s2
labs[key].onmouseover=function(){
var mypic = this.getElementsByTagName("img")[0];
setTimeout(function(){mypic.style.backgroundPosition="0 -28px";},delay/2);
setTimeout(function(){mypic.style.backgroundPosition="0 -14px";},delay);
}
labs[key].onmouseout=function(){
var mypic = this.getElementsByTagName("img")[0];
setTimeout(function(){mypic.style.backgroundPosition="0 -28px";},delay);
setTimeout(function(){mypic.style.backgroundPosition="0 0";},delay*2);
}
labs[key].onclick=function(){
var myipt = this.getElementsByTagName("input")[0];
var mypic = this.getElementsByTagName("img")[0];
if(myipt.checked)
myipt.checked=false;
else
myipt.checked=true;
mypic.src=(myipt.checked)?"./img/3.gif":"./img/4.gif";
}
}
}
if(window.attachEvent) {
window.attachEvent("onload", mycbox);
}
else if(window.addEventListener) {
window.addEventListener('DOMContentLoaded', mycbox, false);
}
作者: me7an 发布时间: 2010-05-10
理想没有肯帮忙的人了么?
作者: me7an 发布时间: 2010-05-11
name要相同……
作者: cutsin 发布时间: 2010-05-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28