Keydown上的脚本更改在本地工作,但不在服务器上

时间:2014-07-22 08:41:03

标签: javascript arrays keycode

在本地测试时,下面的示例工作正常。它在鼠标按下时循环显示不同的jsmovermaps,但是当我在服务器上测试它时,它不会更新与光标按下相关的jsmovermap。我已正确上传地图。任何帮助将不胜感激。

非常感谢!!!

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Ireland Map</title>
    <link type="text/css" rel="stylesheet" href="jquery.qtip.css" />
    <link rel="stylesheet" type="text/css" href="style2.css">
</head>
<body>
    <div class="map" id="map">
    </div>
    <script src="jquery-2.1.1.min.js"></script>
    <script src="raphael-min.js"></script>
    <script src="jquery.qtip.js"></script>
    <script src="jsmovermap1.js" id="s1"></script>
<script>
x=1;
//alert(x);
document.addEventListener('keydown', function (evt) {
    if (evt.keyCode === 38) {
        //alert('The "UP" key is being held down...?');
        x=x+1;
        //alert(x); 
        //script.src = "jsmovermap"+(x)+".js";

        var s = document.createElement("script");
        s.type = "text/javascript";
        s.src = "jsmovermap"+(x)+".js";;
        s.innerHTML = null;
        s.id = "map";
        document.getElementById("map").innerHTML = "";
        document.getElementById("map").appendChild(s);
        //alert(s.src);

    }
    if (evt.keyCode === 40) {
        //alert('The "DOWN" key is being held down...?');
        x=x-1;
        if(x<1){
            x=1}

        var s = document.createElement("script");
        s.type = "text/javascript";
        s.src = "jsmovermap"+(x)+".js";;
        s.innerHTML = null;
        s.id = "map";
        document.getElementById("map").innerHTML = "";
        document.getElementById("map").appendChild(s);      
        //alert(x);
    }

});

</script>
</body>
</html> 

UPDATE!

这是在多次按下光标后控制台正在吐出的内容。

资源被解释为脚本但使用MIME类型text / html传输:&#34; http://jeremiahambrose.com/maptest/Test/jsmovermap23.js&#34;。

0 个答案:

没有答案