style.fill在IE中不起作用 [英] style.fill Not Working in IE

查看:102
本文介绍了style.fill在IE中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有些无法在IE中完全运行的Javascript代码.它假定使用高光填充交互式图像.它在Chrome浏览器中效果很好,在Firefox中效果更好.看来IE中的style.fill ="#somecolor"行不起作用(假定为??).

I some Javascript code that does not to fully work in IE. Its suppose to fill in an interactive image with highlights. It works fine in Chrome and better in Firefox. It appears the style.fill = "#somecolor" lines are not working (supposed??) in IE.

$(document).ready(function() {

    //
    R = Raphael("stateMap", 700, 475);
    tooltip = new Tooltip();
    for ( var stateCode in usMap) {
        var sObj = usMap[stateCode];
        Rstates[stateCode] = R.path(sObj.path).attr(Rattr);
        if (!!sObj.properties) {
            Rstates[stateCode][0]._zoom = sObj.zoom;
            Rstates[stateCode][0]._title = sObj.title;
            Rstates[stateCode][0]._lat = sObj.lat;
            Rstates[stateCode][0]._lng = sObj.lng;
            Rstates[stateCode][0].style.fill = "#d3d3d3"; // init medium grey overlay
            Rstates[stateCode][0].style.cursor = "pointer";
            Rstates[stateCode][0].onmouseover = function(event){
                this.rel = this.style.fill;
                this.style.fill = "#68973a"; //fill with green
                tooltip.awake(this._title,event);
            };
            Rstates[stateCode][0].onmousemove = function(event) {
                tooltip.move(event);
            };
            Rstates[stateCode][0].onmouseout = function(){
            this.style.fill = "#d3d3d3"; // mouse out color back to medium grey
                tooltip.sleep();
            };
            Rstates[stateCode][0].onmousedown = function() {
                selectedState = this;
                map.setCenter(new google.maps.LatLng(this._lat,this._lng));
                map.setZoom(this._zoom);
                $('#stateMap').fadeOut();
                var n = $('<a>').attr({href:'#'}).html("United States").click(resetNationMap);
                var s = $('<a>').attr({href:'#'}).html(this._title).click(resetStateMap);

                $('#viewStateMap').html(n).append(' &raquo; ').append(s).fadeIn();
            }
        }
    }
});



是否可以解决以下问题?



is there a work around to get the lines like below to work?

this.style.fill = "#68973a";



谢谢

Eric



Thanks

Eric

推荐答案

(document).ready(function(){ // R = Raphael(" 700 475 ); tooltip = Tooltip(); for ((span class ="code-keyword"> var stateCode in usMap){ var sObj = usMap [stateCode]; Rstates [stateCode] = R.path(sObj.path).attr(Rattr); 如果(!! sObj.properties){ Rstates [stateCode] [ 0 ] ._ zoom = sObj.zoom; Rstates [stateCode] [ 0 ] ._ title = sObj.title; Rstates [stateCode] [ 0 ] ._ lat = sObj.lat; Rstates [stateCode] [ 0 ] ._ lng = sObj.lng; Rstates [stateCode] [ 0 ].style.fill = " #d3d3d3"; // 初始中灰色叠加层 Rstates [stateCode] [ 0 ].style.cursor = " 指针" ; Rstates [stateCode] [ 0 ].onmouseover = function( event ){ .rel = .style.fill; .style.fill = " 跨度>; // 用绿色填充 tooltip.awake( ._ title,事件); }; Rstates [stateCode] [ 0 ].onmousemove = function( event ){ tooltip.move(事件); }; Rstates [stateCode] [ 0 ].onmouseout = function(){ .style.fill = " 跨度>; // 鼠标移出颜色回到中等灰色 tooltip.sleep(); }; Rstates [stateCode] [ 0 ].onmousedown = function(){ selectedState = ; map.setCenter( google.maps.LatLng( ._ lat, ._ zoom);
(document).ready(function() { // R = Raphael("stateMap", 700, 475); tooltip = new Tooltip(); for ( var stateCode in usMap) { var sObj = usMap[stateCode]; Rstates[stateCode] = R.path(sObj.path).attr(Rattr); if (!!sObj.properties) { Rstates[stateCode][0]._zoom = sObj.zoom; Rstates[stateCode][0]._title = sObj.title; Rstates[stateCode][0]._lat = sObj.lat; Rstates[stateCode][0]._lng = sObj.lng; Rstates[stateCode][0].style.fill = "#d3d3d3"; // init medium grey overlay Rstates[stateCode][0].style.cursor = "pointer"; Rstates[stateCode][0].onmouseover = function(event){ this.rel = this.style.fill; this.style.fill = "#68973a"; //fill with green tooltip.awake(this._title,event); }; Rstates[stateCode][0].onmousemove = function(event) { tooltip.move(event); }; Rstates[stateCode][0].onmouseout = function(){ this.style.fill = "#d3d3d3"; // mouse out color back to medium grey tooltip.sleep(); }; Rstates[stateCode][0].onmousedown = function() { selectedState = this; map.setCenter(new google.maps.LatLng(this._lat,this._lng)); map.setZoom(this._zoom);


(' #stateMap').fadeOut(); var n =
('#stateMap').fadeOut(); var n =


(' ' " ).click(resetNationMap); var s =
('<a>').attr({href:'#'}).html("United States").click(resetNationMap); var s =


这篇关于style.fill在IE中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆