请问,这段js有什么错?
<SCRIPT language=JavaScript>
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i<9; i++)
{
if(i == j)
{
document.all['Drop_menu'+i].style.display = 'block';
}else{
document.all['Drop_menu'+i].style.display = 'none';
}
}
}
</SCRIPT>
为什么报:
错误
<SCRIPT language=JavaScript>
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i<9; i++)
{
if(i == j)
{
document.all['Drop_menu'+i].style.display = 'block';
}else{
document.all['Drop_menu'+i].style.display = 'none';
}
}
}
</SCRIPT>
为什么报:
错误
都存在?
LZ就不要只贴JS了..
应该是找不到元素...
<STYLE type=text/css>
a.movec:link { font-size: 12px; color:#FFFFFF; text-decoration: none;}
a.movec:visited { font-size: 12px; text-decoration: none; }
a.movec:active { font-size: 12px; text-decoration: none; }
a.movec:hover { font-size: 12px; POSITION: relative; TOP: 1px; color:#FFFF00; text-decoration: none}
#Drop_menu0 {display:block;font-size:9pt; overflow:hidden}
#Drop_menu1 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu2 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu3 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu4 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu5 {display:none; font-size:9pt; overflow:hidden}
</STYLE>
<table border="0" width="960" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table border="0" width="960" id="table1" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" width="360"></td>
<td rowspan="2" width="16"></td>
<td colspan="6" height="32"></td>
<td rowspan="2" width="8"></td>
</tr>
<tr>
<td width="96" height="28"><A href="{$InstallDir}index.asp"><IMG onMouseOver="this.src='images/bu1_1.gif';actionMenu('0')" onMouseOut="this.src='images/bu1.gif'" height=28 alt="" src="images/bu1.gif" width=96 border=0></A></td>
<td width="96" height="28"><A href="{$InstallDir}shop"><IMG onMouseOver="this.src='images/bu2_1.gif';actionMenu('1')" onMouseOut="this.src='images/bu2.gif'" height=28 alt="" src="images/bu2.gif" width=96 border=0></A></td>
<td width="96" height="28"><A href="{$InstallDir}Article/ShowClass.asp?ClassID=118"><IMG onMouseOver="this.src='images/bu3_1.gif';actionMenu('2')" onMouseOut="this.src='images/bu3.gif'" height=28 alt="" src="images/bu3.gif" width=96 border=0></A></td>
<td width="96" height="28"><A href="{$InstallDir}Article/ShowClass.asp?ClassID=119"><IMG onMouseOver="this.src='images/bu4_1.gif';actionMenu('3')" onMouseOut="this.src='images/bu4.gif'" height=28 alt="" src="images/bu4.gif" width=96 border=0></A></td>
<td width="96" height="28"><A href="{$InstallDir}Article/ShowClass.asp?ClassID=120"><IMG onMouseOver="this.src='images/bu5_1.gif';actionMenu('4')" onMouseOut="this.src='images/bu5.gif'" height=28 alt="" src="images/bu5.gif" width=96 border=0></A></td>
<td width="96" height="28"><A href="{$InstallDir}guestbook" target="_blank"><IMG onMouseOver="this.src='images/bu6_1.gif';actionMenu('5')" onMouseOut="this.src='images/bu6.gif'" height=28 alt="" src="images/bu6.gif" width=96 border=0></A></td>
</tr>
</table>
<SCRIPT language=JavaScript>
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i<9; i++)
{
if(i == j)
{
document.all['Drop_menu'+i].style.display = 'block';
}else{
document.all['Drop_menu'+i].style.display = 'none';
}
}
}
</SCRIPT>
<table border="0" width="960" cellspacing="0" cellpadding="0" height="22" background="images/lmenu_bg.gif">
<tr>
<td valign="top"><img border="0" src="images/me_l.gif" width="5" height="22"></td>
<td valign="top" width="950">
<TABLE id=Drop_menu0 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22><TD align=right><span style="letter-spacing: 3pt"><font color=#FFFF00><b>只需鼠标轻轻一点,至In潮流资讯、至Top精选货品,源源不断为你奉上! </b></font></span></TD></TR></TABLE>
<TABLE id=Drop_menu1 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22><TD align="right"><A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=1">2楼男服商场</A>
| <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=2">3楼女士商场</A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=3">
3楼金饰商场</A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=4">
3楼日用商场</A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=5">
5楼运动营</A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=6">
7楼影音商场</A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=7">
7楼折扣店</A> </TD></TR></TABLE>
<TABLE id=Drop_menu2 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22><TD align="right"><A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=121">商场介绍</A>
| <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=122">特惠快讯</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=123">
新品推介</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=124">
品牌故事</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=125">
精明买家</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=126">
标识大全</A> </TD></TR></TABLE>
<TABLE id=Drop_menu3 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22><TD align="right"><A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=127">靓丽娇颜</A>
| <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=128">
潮流服饰</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=129">
皮具世界</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=130">
数码天地</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=131">
璀璨珠宝</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=132">
炫音魅影</A> </TD></TR></TABLE>
<TABLE id=Drop_menu4 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22><TD align="right"><A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=133">
公司简介</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=134">
公司动态</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=135">
会员服务</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=136">
精彩回眸</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=137">
合作联盟</A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=138">
业务指南</A> </TD></TR></TABLE>
<TABLE id=Drop_menu5 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22><TD align=right><span style="letter-spacing: 3pt"><font color=#FFFFFF><b>我们的进步有赖您的支持,欢迎留下您的宝贵意见!</b></font>
</span> </TD></TR></TABLE></td>
<td valign="top"><img border="0" src="images/me_r.gif" width="5" height="22"></td></tr></table></td></tr></table>
请问,这段js有什么错? 修改见红色部分,试看<SCRIPT language=JavaScript>
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i <9; i++)
{
if(i == j)
{
document.all.['Drop_menu'+i].style.display = 'block';
}else{
document.all.['Drop_menu'+i].style.display = 'none';
}
}
}
</SCRIPT> 如果有ID号最好用如下:
document.getElementById("ID号").style.display = 'block';
或
document.getElementById("ID号").style.display = 'none';
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i <6; i++)
{
if(i == j)
{
document.all['Drop_menu'+i].style.display = 'block';
}else{
document.all['Drop_menu'+i].style.display = 'none';
}
}
}
</SCRIPT> 只有0-5嘛...
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i <9; i++)
{
if(i == j)
{
document.getElementById("Drop_menu"+i).style.display = 'block';
}else{
document.getElementById("Drop_menu"+i).style.display = 'none';
}
}
}
</SCRIPT>
=.=
<STYLE type=text/css>
a.movec:link { font-size: 12px; color:#FFFFFF; text-decoration: none;}
a.movec:visited { font-size: 12px; text-decoration: none; }
a.movec:active { font-size: 12px; text-decoration: none; }
a.movec:hover { font-size: 12px; POSITION: relative; TOP: 1px; color:#FFFF00; text-decoration: none}
#Drop_menu0 {display:block;font-size:9pt; overflow:hidden}
#Drop_menu1 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu2 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu3 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu4 {display:none; font-size:9pt; overflow:hidden}
#Drop_menu5 {display:none; font-size:9pt; overflow:hidden}
</STYLE>
<table border="0" width="960" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<table border="0" width="960" id="table1" cellspacing="0" cellpadding="0">
<tr>
<td rowspan="2" width="360"> </td>
<td rowspan="2" width="16"> </td>
<td colspan="6" height="32"> </td>
<td rowspan="2" width="8"> </td>
</tr>
<tr>
<td width="96" height="28"> <A href="{$InstallDir}index.asp"> <IMG onMouseOver="this.src='images/bu1_1.gif';actionMenu('0')" onMouseOut="this.src='images/bu1.gif'" height=28 alt="" src="images/bu1.gif" width=96 border=0> </A> </td>
<td width="96" height="28"> <A href="{$InstallDir}shop"> <IMG onMouseOver="this.src='images/bu2_1.gif';actionMenu('1')" onMouseOut="this.src='images/bu2.gif'" height=28 alt="" src="images/bu2.gif" width=96 border=0> </A> </td>
<td width="96" height="28"> <A href="{$InstallDir}Article/ShowClass.asp?ClassID=118"> <IMG onMouseOver="this.src='images/bu3_1.gif';actionMenu('2')" onMouseOut="this.src='images/bu3.gif'" height=28 alt="" src="images/bu3.gif" width=96 border=0> </A> </td>
<td width="96" height="28"> <A href="{$InstallDir}Article/ShowClass.asp?ClassID=119"> <IMG onMouseOver="this.src='images/bu4_1.gif';actionMenu('3')" onMouseOut="this.src='images/bu4.gif'" height=28 alt="" src="images/bu4.gif" width=96 border=0> </A> </td>
<td width="96" height="28"> <A href="{$InstallDir}Article/ShowClass.asp?ClassID=120"> <IMG onMouseOver="this.src='images/bu5_1.gif';actionMenu('4')" onMouseOut="this.src='images/bu5.gif'" height=28 alt="" src="images/bu5.gif" width=96 border=0> </A> </td>
<td width="96" height="28"> <A href="{$InstallDir}guestbook" target="_blank"> <IMG onMouseOver="this.src='images/bu6_1.gif';actionMenu('5')" onMouseOut="this.src='images/bu6.gif'" height=28 alt="" src="images/bu6.gif" width=96 border=0> </A> </td>
</tr>
</table>
<SCRIPT language=JavaScript>
function actionMenu(order)
{
var j=order;
var nowmenu;
var style;
for(i=0; i <6; i++)
{
if(i == j)
{
document.all['Drop_menu'+i].style.display = 'block';
}else{
document.all['Drop_menu'+i].style.display = 'none';
}
}
}
</SCRIPT>
<table border="0" width="960" cellspacing="0" cellpadding="0" height="22" background="images/lmenu_bg.gif">
<tr>
<td valign="top"> <img border="0" src="images/me_l.gif" width="5" height="22"> </td>
<td valign="top" width="950">
<TABLE id=Drop_menu0 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22> <TD align=right> <span style="letter-spacing: 3pt"> <font color=#FFFF00> <b>只需鼠标轻轻一点,至In潮流资讯、至Top精选货品,源源不断为你奉上! </b> </font> </span> </TD> </TR> </TABLE>
<TABLE id=Drop_menu1 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22> <TD align="right"> <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=1">2楼男服商场 </A>
| <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=2">3楼女士商场 </A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=3">
3楼金饰商场 </A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=4">
3楼日用商场 </A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=5">
5楼运动营 </A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=6">
7楼影音商场 </A> | <A class=movec href="{$InstallDir}Shop/ShowClass.asp?ClassID=7">
7楼折扣店 </A> </TD> </TR> </TABLE>
<TABLE id=Drop_menu2 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22> <TD align="right"> <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=121">商场介绍 </A>
| <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=122">特惠快讯 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=123">
新品推介 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=124">
品牌故事 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=125">
精明买家 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=126">
标识大全 </A> </TD> </TR> </TABLE>
<TABLE id=Drop_menu3 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22> <TD align="right"> <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=127">靓丽娇颜 </A>
| <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=128">
潮流服饰 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=129">
皮具世界 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=130">
数码天地 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=131">
璀璨珠宝 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=132">
炫音魅影 </A> </TD> </TR> </TABLE>
<TABLE id=Drop_menu4 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22> <TD align="right"> <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=133">
公司简介 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=134">
公司动态 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=135">
会员服务 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=136">
精彩回眸 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=137">
合作联盟 </A> | <A class=movec href="{$InstallDir}Article/ShowClass.asp?ClassID=138">
业务指南 </A> </TD> </TR> </TABLE>
<TABLE id=Drop_menu5 style="DISPLAY: none" cellSpacing=0 cellPadding=0 width=950 border=0>
<TR height=22> <TD align=right> <span style="letter-spacing: 3pt"> <font color=#FFFFFF> <b>我们的进步有赖您的支持,欢迎留下您的宝贵意见! </b> </font>
</span> </TD> </TR> </TABLE> </td>
<td valign="top"> <img border="0" src="images/me_r.gif" width="5" height="22"> </td> </tr> </table> </td> </tr> </table>
</body>
不行么?
给你一个示例,自己看看
function delGroupsClick(prefix)
{
var isContinue = true;
var i = 0;
var j = 0;
var idStr = "";
while(isContinue)
{
var cBox = document.getElementById(prefix+(i++));
if(cBox)
{
if(cBox.checked)
{
if(prefix == 'g'){
idStr += j == 0 ? cBox.value : ','+cBox.value;
}
else
idStr += j == 0 ? cBox.pid : ','+cBox.pid;
j ++;
}
}
else
{
isContinue = false;
break;
}
}
}
welcome:GetDate()+' 欢迎您光蜀山.栖镇官方网站!',
about:'',
products:'',
promise:'',
talents:'',
shushan:'',
index:''
};
function switchMenu(index)
{
for (key in submenus)
{
if (key==index)
{
document.getElementById('__menu_'+key).style.display='';
}
else
{
document.getElementById('__menu_'+key).style.display='none';
}
}
}function GetDate(){
var ThisDay = new Date();
var week = new Array("星期日", "星期一", "星期二","星期三","星期四", "星期五","星期六");
var s = ThisDay.getFullYear()+"年"+(ThisDay.getMonth()+1)+"月"+ThisDay.getDate()+"日 "+week[ThisDay.getDay()];
return(s);
}
这个js有什么错
__menu_products
__menu_promise
__menu_talents
__menu_shushan
__menu_index
都存在吗?
__menu_welcome
存在吗?