在javascript中显示onmouseover上的另一个图像

时间:2013-06-04 22:22:10

标签: c# javascript visual-studio-2012 onmouseover

我在Visual Studio中遇到问题。我想要做的是当我将鼠标悬停在该国家的地区时,就像在这个网站www.pazar3.mk上一样,该区域的新图像应该以新的颜色出现(透明)。我要发布我的代码。它不会返回错误,但它也不起作用。当我点击该区域时它只会带我到另一个.aspx网站,它不会显示另一个带有新颜色的图像。这是我的代码,所以请你告诉我我缺少什么,或者我应该用我的代码改变一些东西?

enter image description here

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"      Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<style type="text/css">
    .auto-style1 {
        width: 530px;
        height: 380px;
        z-index: 1;
        left: 10px;
        top: 399px;
        position: absolute;
    }
    .auto-style2 {
        width: 530px;
        height: 380px;
    }
</style>
<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) {
            img1 = newImage("Sliki/1.gif");
            img2 = newImage("Sliki/2.gif");
            img12 = newImage("Sliki/12.gif");
            img23 = newImage("Sliki/23.gif");

            preloadFlag = true;
        }
    }

</script>
</head>
<body onload="preloadImages();" >
<form id="form1" runat="server">
<div  style="height: 386px; width: 906px">  
    <img  src="Sliki/map (1).jpg" width="530" height="380"  id="map"
                usemap="#m_map" alt="" /><map name="m_map" id="m_map">
                    <area shape="poly" coords="167,335,168,321,166,318,161,313,156,308,148,308,146,304,143,302,137,301,136,293,133,283,130,277,127,273,127,270,129,266,133,261,133,253,132,248,128,242,124,240,121,240,118,243,114,248,108,254,100,258,94,261,92,261,91,268,87,274,83,279,81,281,81,286,81,291,81,295,75,298,69,304,67,308,66,316,69,318,79,319,86,319,88,321,91,324,94,326,100,325,102,322,103,317,100,315,95,314,88,312,85,308,87,303,90,300,94,297,98,294,104,293,109,293,113,295,119,303,124,311,127,318,130,327,131,335,132,338,135,336,140,332,144,331,148,331,151,333,155,336,162,336,167,335"
                        href="Default2.aspx" title="Resen" alt="Resen" onmouseover="changeImages('map', 'Sliki/23.gif'); return true;"
                        onmouseout="changeImages('map', 'Sliki/map(1).jpg'); return true;" onmousedown="changeImages('map', 'Sliki/23.gif'); return true;"
                        onmouseup="changeImages('map', 'Sliki/23.gif'); return true;" />
                    </map>    
</div>
</form>

0 个答案:

没有答案