Jquery .html()和IE8奇怪的行为

时间:2011-12-07 12:33:34

标签: jquery internet-explorer-8

我有一个可以在IE7和IE8上运行良好的java脚本,但是我已经阅读了有关这个漂浮在互联网上的所有帖子,但它没有回答我的问题。

该脚本正在添加一个谷歌地图标记侦听器,用于单击以使用ajax调用的结果更新div的值。

代码如下:

    google.maps.event.addListener(marker, 'click', function () {
                $.ajax({
                    type: "GET",
                    url: "ajaxcalls/LocationInformation",
                    data: "locationName=" + item.Designation.toString(),
                    datatype: "json",
                    success: function (result) {
                        var windowcontent = "<div>Site Name: ";
                        windowcontent = windowcontent + result.Designation + "</div>";
                        windowcontent = windowcontent + "<div>Address: " + result.Address + "</div>";
                        windowcontent = windowcontent + "<div>City: " + result.CityName + "</div>";
                        windowcontent = windowcontent + "<div>Region: " + result.RegionName + "</div>";
                        windowcontent = windowcontent + "<div>Country: " + result.CountryName + "</div>";
                        windowcontent = windowcontent + "<div>GPS Co Ords: " + result.GPSCoOrds + "</div>";
                        windowcontent = windowcontent + "<div>Contact Number: " + result.contactNumber + "</div>";
                        windowcontent = windowcontent + "<div>Branch Type: " + result.BranchType + "</div>";
                        windowcontent = windowcontent + "<div>Network Provider: " + result.NetworkProvider + "</div>";
                        windowcontent = windowcontent + "<div>Network Capacity: " + result.NetworkCapacity + "</div>";
                        $("#rbar").html(windowcontent);
                        $("#dlocations").html(result.GPSCoOrds);
                    },
                    error: function (req, stats, error) {
                        alert("addClick" + error);
                    }
                });
            });

$(“#rbar”)。html(windowcontent);仅适用于FIRST元素,因此它将我的rbar div的值设置为&lt;网站:&gt;但它没有设置其余的值。

div具有以下尺寸(200px高100%宽)。

奇怪的是,有一个悬停监听器添加了100%工作的相同代码。代码如下:

                    google.maps.event.addListener(marker, 'mouseover', function () {
                $.ajax({
                    type: "GET",
                    url: "ajaxcalls/LocationInformation",
                    data: "locationName=" + item.Designation.toString(),
                    datatype: "json",
                    success: function (result) {
                        var windowcontent = "<div>Site Name: ";
                        windowcontent = windowcontent + result.Designation + "</div>";
                        windowcontent = windowcontent + "<div>Address: " + result.Address + "</div>";
                        windowcontent = windowcontent + "<div>Network Provider: " + result.NetworkProvider + "</div>";
                        windowcontent = windowcontent + "<div>Network Capacity: " + result.NetworkCapacity + "</div>";
                        $("#markertxt").html(windowcontent);

                    },
                    error: function (req, stats, error) {
                        alert("Addmover" + error);
                    }
                });
            });

任何想法?

0 个答案:

没有答案