请问这段代码怎么回事?

pxk 2004-04-30 03:40:10
我遇到如下一段代码,是javascript得,在函数ChangeImages()定义得时候得参数和调用得时候不一样,不过还是可以正常执行,请高手来救命啊:)



<%@ Page language="c#" Codebehind="Toolbar.aspx.cs" AutoEventWireup="false" Inherits="Swat.Toolbar" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Toolbar</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<SCRIPT language="JavaScript">
function LoadImage(src)
{
if (document.images)
{
imgButton = new Image();
imgButton.src = src;
return imgButton;
}
}

function ChangeImages()
{
if (document.images && (boolImagesLoaded == true))
{
for (var i=0; i<ChangeImages.arguments.length; i+=2)
{
document[ChangeImages.arguments[i]].src = ChangeImages.arguments[i+1];
}
}
}

var boolImagesLoaded = false;
function PreloadImages()
{
if (document.images)
{
TbHomeImage = LoadImage("Toolbar_Home_hover.gif");
TbBugsImage = LoadImage("Toolbar_Bugs_hover.gif");
TbAnalyzeImage = LoadImage("Toolbar_Analyze_hover.gif");
TbReportImage = LoadImage("Toolbar_Report_hover.gif");
TbAdminImage = LoadImage("Toolbar_Admin_hover.gif");
TbSystemImage = LoadImage("Toolbar_System_hover.gif");
TbHelpImage = LoadImage("Toolbar_Help_hover.gif");
TbLogoutImage = LoadImage("Toolbar_Logout_hover.gif");

boolImagesLoaded = true;
}
}

PreloadImages();
</SCRIPT>
</HEAD>
<body topmargin="0" leftmargin="0" bgColor="#fffbf0">
<form id="Toolbar" method="post" runat="server">
<table cellSpacing="0" cellPadding="0">
<tr>
<td>   </td>
<td><a onmouseover="ChangeImages('TbHomeImage', 'Toolbar_Home_hover.gif'); return true; " onmouseout="ChangeImages('TbHomeImage', 'Toolbar_Home.gif'); return true; "><IMG height="32" alt="Home" src="Toolbar_Home.gif" width="32" border="0" name="TbHomeImage"></a>
</td>
<td>    </td>
<td><A onmouseover="if (1 & <%=UserRole%>) ChangeImages('TbBugsImage', 'Toolbar_Bugs_hover.gif'); else window.event.cancelBubble = true; return true; " onclick="if (1 & <%=UserRole%>) return true; else return false;" onmouseout="ChangeImages('TbBugsImage', 'Toolbar_Bugs.gif'); return true; " href="SwatBugs.aspx" target=MainFrame ><IMG height="32" alt="Bugs" src="Toolbar_Bugs.gif" width="32" border="0" name="TbBugsImage"></A>
</td>
<td>  </td>
<td><A onmouseover="if (4 & <%=UserRole%>) ChangeImages('TbAnalyzeImage', 'Toolbar_Analyze_hover.gif'); else window.event.cancelBubble = true; return true; " onclick="if (4 & <%=UserRole%>) return true; else return false;" onmouseout="ChangeImages('TbAnalyzeImage', 'Toolbar_Analyze.gif'); return true; " href="SwatAnalyze.aspx" target=MainFrame ><IMG height="32" alt="Analyze" src="Toolbar_Analyze.gif" width="32" border="0" name="TbAnalyzeImage"></A>
</td>
<td>  </td>
<td><A onmouseover="ChangeImages('TbReportImage', 'Toolbar_Report_hover.gif'); return true; " onmouseout="ChangeImages('TbReportImage', 'Toolbar_Report.gif'); return true; " href="SwatReport.aspx" target="MainFrame"><IMG height="32" alt="Reports" src="Toolbar_Report.gif" width="32" border="0" name="TbReportImage"></A>
</td>
<td>  </td>
<td><A onmouseover="if (2 & <%=UserRole%>) ChangeImages('TbAdminImage', 'Toolbar_Admin_hover.gif'); else window.event.cancelBubble = true; return true; " onclick="if (2 & <%=UserRole%>) return true; else return false;" onmouseout="ChangeImages('TbAdminImage', 'Toolbar_Admin.gif'); return true; " href="SwatAdmin.aspx" target=MainFrame ><IMG height="32" alt="Admin" src="Toolbar_Admin.gif" width="32" border="0" name="TbAdminImage"></A>
</td>
<td style="WIDTH: 3px">    </td>
<td style="WIDTH: 10px"><A onmouseover="if (2 & <%=UserRole%>) ChangeImages('TbOptionsImage', 'Toolbar_System_hover.gif'); return true; " onclick="if (2 & <%=UserRole%>){refWindow=window.open('SwatOptions.aspx','referralWindow','width=350,height=400,scrollbars=no,menubar=no,resizable=no'); refWindow.focus();} return false;" onmouseout="ChangeImages('TbOptionsImage', 'Toolbar_System.gif'); return true; " href="SwatOptions.aspx" target=_blank ><IMG height="32" alt="Swat Options" src="Toolbar_System.gif" width="32" border="0" name="TbOptionsImage"></A>
</td>
<td>    </td>
<td><A onmouseover="ChangeImages('TbHelpImage', 'Toolbar_Help_hover.gif'); return true; " onclick="refWindow=window.open('SwatHelp.htm','referralWindow','width=350,height=520,scrollbars=yes,menubar=no,resizable=yes'); refWindow.focus(); return false;" onmouseout="ChangeImages('TbHelpImage', 'Toolbar_Help.gif'); return true; " href="SwatHelp.aspx" target="_blank"><IMG height="32" alt="Help" src="Toolbar_Help.gif" width="32" border="0" name="TbHelpImage"></A>
</td>
<td>    </td>
<td><a onmouseover="ChangeImages('TbLogoutImage', 'Toolbar_Logout_hover.gif'); return true; " onmouseout="ChangeImages('TbLogoutImage', 'Toolbar_Logout.gif'); return true; "><IMG height="32" alt="Logout" src="Toolbar_Logout.gif" width="32" border="0" name="TbLogoutImage"></a>
</td>
</tr>
</table>
</form>
</body>
</HTML>
...全文
33 4 点赞 打赏 收藏 举报
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
singleflower 2004-04-30
不会报错吗,还是没有执行?应该不会执行的。
我不大东着个东东
  • 打赏
  • 举报
回复
pxk 2004-04-30
定义得时候是:
function ChangeImages()
{
.......
}

调用的时候是:
ChangeImages('TbHelpImage', 'Toolbar_Help_hover.gif')
  • 打赏
  • 举报
回复
孟子E章 2004-04-30
你要问什么问题呀
  • 打赏
  • 举报
回复
dayasky 2004-04-30
不清楚什么问题
  • 打赏
  • 举报
回复
相关推荐
发帖
.NET社区
加入

5.9w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2004-04-30 03:40
社区公告
暂无公告