1:为什么下面的代码复选框验证同“选定值”有冲突?2:如果提交之后转到另一个”WINDOWS MEDIA PLAYER“插件页面,一首接一首播出我复选框的音乐它的思路又是怎样?冲突代码如下:
<div align="center"><SCRIPT LANGUAGE="javascript">
function checkAll(str)
{
var a = document.getElementsByName(str);
var n = a.length;
for (var i=0; i<n; i++)
a[i].checked = window.event.srcElement.checked;
}
function checkItem(str)
{
var e = window.event.srcElement;
var all = eval("document.hrong."+ str);
if (e.checked)
{
var a = document.getElementsByName(e.name);
all.checked = true;
for (var i=0; i<a.length; i++)
{
if (!a[i].checked){ all.checked = false; break;}
}
}
else all.checked = false;
}
</SCRIPT>
<div align="center"><SCRIPT LANGUAGE="javascript">
<!-- Begin
function checkAll() {
var o=document.getElementsByName("C1"
;
for (var j = 0; j < o.length; j++) {
var box=o[j];
o[j].checked = true;
}
}
function uncheckAll() {
var o=document.getElementsByName("C1"
;
for (var j = 0; j < o.length; j++) {
var box=o[j];
box.checked = false;
}
}
function switchAll() {
var o=document.getElementsByName("C1"
;
for (var j = 0; j < o.length; j++) {
var box=o[j];
box.checked = !box.checked;
}
}
// End -->
</script>
<form ACTION="" METHOD="POST" name=checkboxform>
<div align="center">
<input name=C1 type=checkbox value="http://localhost/流行前线插件/别说我的眼泪你无所谓1.asp">
<br>
<input name=C1 type=checkbox value="http://localhost/流行前线插件/当你孤单你会想起谁1.asp">
<br>
<input name=C1 type=checkbox value="http://localhost/流行前线插件/两只蝴蝶1.asp">
<br>
<br>
<input type=button value="全选" onClick="checkAll()">
<input type="submit" name="Submit" onclick="go_c1('c1','link')"value="提交">
<input type=button value="反选" onClick="uncheckAll()">
<br>
<br>
<br>
<input type="hidden" name="MM_insert" value="checkboxform">
</div>
</form>
</body>
<SCRIPT LANGUAGE="javascript">
<!--
function go_c1(o1,o2){
o1=document.getElementsByName(o1);
o2=document.getElementById(o2);
for (var i=0;i<o1.length;i++){
if (o1[i].checked)
{o2.href=o1[i].value;
o2.click();
}
}
}
//-->
</SCRIPT>
<BODY>
<a href="#" id="link" target="_blank"></a>
</body><script language="javascript">
function check()
{
len = document.checkboxform.elements.length-1;
for(i=0,num=0;i<len;i++)
{
if(document.checkboxform.elements[i].checked)
{num++;}
}
if(num>0)
return true;
else
{
alert("至少选一首歌^-^"
;
return false;
}
}
</script>