Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/470.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 用于Firefox和Chrome中图片的onmouseover_Javascript_C#_Asp.net_Xhtml_Dom Events - Fatal编程技术网

Javascript 用于Firefox和Chrome中图片的onmouseover

Javascript 用于Firefox和Chrome中图片的onmouseover,javascript,c#,asp.net,xhtml,dom-events,Javascript,C#,Asp.net,Xhtml,Dom Events,在IE中运行之后,我在Mozilla和Chrome中的mouseover出现了问题,我可以肯定地告诉你,我的代码至少在Chrome中运行得很好,因为这是我的默认浏览器,我在创建Javascript时使用它进行调试,它运行得很好。。。直到我试图让它在IE中也起作用 在这里,我发布了我遇到问题的网页的完整代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebbShop.aspx.cs" Inherits="FSwebp

在IE中运行之后,我在Mozilla和Chrome中的mouseover出现了问题,我可以肯定地告诉你,我的代码至少在Chrome中运行得很好,因为这是我的默认浏览器,我在创建Javascript时使用它进行调试,它运行得很好。。。直到我试图让它在IE中也起作用

在这里,我发布了我遇到问题的网页的完整代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebbShop.aspx.cs" Inherits="FSwebportal.WebbShop" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">  
<style> 
.prodShow{width: 100%; text-align:center;border:0; float:right; position:inherit; padding-left:310px;}
#prodFollow{display:block; width:100%; height:100%; position:fixed; overflow:hidden;}
#orderSett{display:block; position:relative; float:left; padding-top:inherit;}
.ShowBig{width:290px;height:290px; padding-top:10px;}
.pTb{width:50px;}
.order{background-color:Transparent;margin:3px;}
.txtArea{border:0;overflow:auto;width:200px;height:100px;}
.prodRow{background-image:url("produktbakgrund.png"); background-repeat:repeat;}
.row{background-color:Transparent;width:100%;margin: 0px auto;display:inline-table;}
.col{background-color:Transparent;width:100%;margin:3px;}
</style>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <center><input type="button" value="Visa allt" onclick="javascript:appendRow()" class="append_row" /></center>
        <hr />

        <div id="prodFollow">
            <table id="dumbTable">
                <tr>
                    <td>
                        <img id="sideImg" class="ShowBig" src="" alt=""/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <h3><b>Specifikationer:</b></h3>
                        <select name="">
                        </select>
                    </td>
                </tr>
            </table>
        </div>

        <table id="itemList" class="prodShow" cellspacing="0">
            <thead>
                <tr class="prodRow">
                    <th>Bild</th>
                    <th>Förklaring</th>
                    <th>Artikelnummer</th>
                    <th>Pris</th>
                </tr>
            </thead>
        </table>

        <script type="text/javascript">
                function appendRow() {
                    var tbl = document.getElementById('itemList');


                    var len = <%= aspInfo.Count %>;
                    var arr = new Array(len);
                    var currIndex = 0;
                    var imgID=0;

                    <%
                        for (int x = 0; x < aspInfo.Count; x++) {
                                Response.Write("arr["+x+"]= '"+ aspInfo[x]+"';");
                        }
                    %>

                    for(row =0; row < arr.length/4;row++)
                    {
                    var rad = tbl.insertRow(tbl.rows.length);
                    rad.setAttribute('class','prodRow');
                        for (c = 0; c < tbl.rows[row].cells.length; c++) 
                        {
                                if(c < 1)
                                {
                                    createCell(rad.insertCell(c), arr[currIndex], 'col',imgID);
                                    imgID++;
                                }
                                else {
                                    if(c < 3)
                                    {
                                        createCell(rad.insertCell(c),"<Label class=txtArea>" + arr[currIndex] + "</Label>", 'row',imgID);
                                    }
                                    else
                                    {
                                        createCell(rad.insertCell(c),"<Label class=txtArea>" + arr[currIndex] + " SKR</Label><br>Antal:<input type=text class=pTb /><input type=button width=100px value='Lägg i varukorg'></input>", 'order',imgID);
                                    }
                                }
                                currIndex++;
                        }
                    }
                }

                function createCell(cell, text, style,imgID) {
                    if (style == 'col') {
                        var arrLen = <% = largeImg.Count %>;
                        var imgArr = new Array(arrLen);

                        <%
                        for (int x = 0; x < largeImg.Count; x++) {
                                Response.Write("imgArr["+x+"]= '"+ largeImg[x]+"';");
                        }
                        %>

                        var div = document.createElement('div');
                        div.setAttribute('class', style);
                        div.setAttribute('className', style);
                        div.innerHTML = "<a href='#'><img id='" + imgID + "' src='" + text + "' onmouseover=javascript:onImg('" + imgArr[imgID] + "')  border='0' alt='Animg' /></a>"; 
                        cell.appendChild(div);
                    }
                    else {
                        var div = document.createElement('div');
                        div.setAttribute('class', style);
                        div.setAttribute('className', style);
                        div.innerHTML = text;
                        cell.appendChild(div);
                    }
                }
    </script>
    <script type="text/javascript" language="javascript">
                    function onImg(bigImg) {
                        var img = document.getElementById('sideImg#');
                        img.src = bigImg;

                        alert(img.src.toString());
                    }
    </script>
    </form>
</body>
</html>

.prodShow{宽度:100%;文本对齐:居中;边框:0;浮点:右;位置:继承;左填充:310px;}
#prodFollow{显示:块;宽度:100%;高度:100%;位置:固定;溢出:隐藏;}
#orderSett{display:block;position:relative;float:left;padding top:inherit;}
.ShowBig{宽度:290px;高度:290px;填充顶部:10px;}
.pTb{宽度:50px;}
.order{背景色:透明;边距:3px;}
.txtArea{边框:0;溢出:自动;宽度:200px;高度:100px;}
.prodRow{背景图像:url(“produktbakgrund.png”);背景重复:重复;}
.row{背景色:透明;宽度:100%;边距:0px自动;显示:内联表;}
.col{背景色:透明;宽度:100%;边距:3px;}

说明符: 图片报 弗尔克拉林 艺术大师 普里斯 函数appendRow(){ var tbl=document.getElementById('itemList'); var len=; var arr=新阵列(len); 风险价值指数=0; var-imgID=0; 对于(行=0;行Antal:”,“order”,imgID); } } currendex++; } } } 函数createCell(单元格、文本、样式、imgID){ 如果(样式=='col'){ var arrLen=; var imgArr=新阵列(arrLen); var div=document.createElement('div'); div.setAttribute(“类”,样式); div.setAttribute('className',style); div.innerHTML=“”; 子单元(div); } 否则{ var div=document.createElement('div'); div.setAttribute(“类”,样式); div.setAttribute('className',style); div.innerHTML=文本; 子单元(div); } } 函数onImg(bigImg){ var img=document.getElementById('sideImg#'); img.src=bigImg; 警报(img.src.toString()); }
我希望你能帮我解决这个问题

// wrong var img = document.getElementById('sideImg#');


var img = document.getElementById('#sideImg');

希望这有帮助

谢谢你的回复,约翰。 我已经解决了问题,而不是代码错了。 这是我自己的错,创建了一个div以在左侧包含一个picuture。 问题是,div认为左手边不够,但通过隐藏后面的图片覆盖了页面的整个宽度:P 希望这能帮助其他人在将来犯同样的错误


问候David

请编辑帖子以正确显示css