日期:2014-05-18  浏览次数:20632 次

为什么我的js代码没有起到效果
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title></title>
<script type="text/javascript">
function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

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

var preloadFlag = false;
function preloadImages() {
if (document.images) {
Button1_over = newImage("images/Button1-over.gif");
Button2_over = newImage("images/Button2-over.gif");
Button3_over = newImage("images/Button3-over.gif");
Button4_over = newImage("images/Button4-over.gif");
Button5_over = newImage("images/Button5-over.gif");
Shopping_cart_over = newImage("images/Shopping-cart-over.gif");
Button6_over = newImage("images/Button6-over.gif");
Button7_over = newImage("images/Button7-over.gif");
preloadFlag = true;
}
}
</script>
</head>
<body topmargin ="0" leftmargin ="0" rightmargin ="0">
<center>
  <form id="form1" runat="server">
  <div id="MainContent" style ="width:100%;"><!--总的框架-->
  <div><!--头部的框架-->
 <TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><!--DWLayoutTable-->
<TR>
<TD COLSPAN=3 ROWSPAN=3 background="images/layout_34.gif" valign="top">
<IMG SRC="images/layout_01.gif" WIDTH=375 HEIGHT=76 ALT=""></TD>
<TD COLSPAN=6 ROWSPAN=5>
<IMG SRC="images/layout_02.gif" WIDTH=173 HEIGHT=107 ALT=""></TD>
<TD COLSPAN=2>
<A HREF="#"
onmouseover="changeImages('Button1', 'images/Button1-over.gif'); return true;"
onmouseout="changeImages('Button1', 'images/Button1.gif'); return true;">
<IMG NAME="Button1" SRC="images/Button1.gif" WIDTH=182 HEIGHT=27 BORDER=0 ALT=""></A></TD>
<TD COLSPAN=2 ROWSPAN=11 background="images/layout_04.gif">
<IMG SRC="images/layout_04.gif" WIDTH=30 HEIGHT=319 ALT=""></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=27 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=2>
<A HREF="#"
ONMOUSEOVER="changeImages('Button2', 'images/Button2-over.gif'); return true;"
ONMOUSEOUT="changeImages('Button2', 'images/Button2.gif'); return true;">
<IMG NAME="Button2" SRC="images/Button2.gif" WIDTH=182 HEIGHT=31 BORDER=0 ALT=""></A></TD>
<TD>
<IMG SRC="images/spacer.gif" WIDTH=1 HEIGHT=31 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=2 ROWSPAN=2>
<A HREF="#"
ONMOUSEOVER="changeImages('Button3', 'images/Button3-over.gif'); return true;"
ONMOUSEOUT=&q