SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    body shows then disappears only in ie

    For some reason my page shows the main body for a second on ie and then disappears. It works fine on every other browser and on every other page works on ie which is pretty much the same code. Any help would be great
    http://www.influencealife.org/influence.html
    Thanks

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,380
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    It's probable because you are givng ie7 and 8 the png script which should only go to ie6.

    Try this.

    Code:
    <!--[if lte IE 6]>
    
    <script>  var bgsleight    = function() {
        
        function addLoadEvent(func) {
            var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
            } else {
                window.onload = function() {
                    if (oldonload) {
                        oldonload();
                    }
                    func();
                }
            }
        }
        
        function fnLoadPngs() {
            var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
            var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
            for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
                if (itsAllGood && obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
                    fnFixPng(obj);
                    obj.attachEvent("onpropertychange", fnPropertyChanged);
                }
            }
        }
    
        function fnPropertyChanged() {
            if (window.event.propertyName == "style.backgroundImage") {
                var el = window.event.srcElement;
                if (!el.currentStyle.backgroundImage.match(/x\.gif/i)) {
                    var bg    = el.currentStyle.backgroundImage;
                    var src = bg.substring(5,bg.length-2);
                    el.filters.item(0).src = src;
                    el.style.backgroundImage = "url(x.gif)";
                }
            }
        }
    
        function fnFixPng(obj) {
            var bg    = obj.currentStyle.backgroundImage;
            var src = bg.substring(5,bg.length-2);
            obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
            obj.style.backgroundImage = "url(x.gif)";
        }
        
        
        
        
        return {
            
            init: function() {
                
                if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
                    addLoadEvent(fnLoadPngs);
                }
                
            }
        }
        
    }();
    
    bgsleight.init();
    </script>
    <![endif]-->
    You should move the script to an external js file anyway and just call it from within the Conditional comments.

  3. #3
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweet thanks Paul that did it!
    Sean

  4. #4
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    I'd also point out you have NOTHING that warrants the use of alpha transparency .png in the first place on that page. (is all that garbage scripting REALLY worth a lousy drop-shadow?) and you've got a bunch of other stuff in there that has no place in your HTML after about 2001.

    Like WIDTH, like ALIGN, Like a TABLE for a menu...

    .. and that's before we talk about bold tags doing HEADING's job, paragraph tags not wrapping paragraphs, line breaks doing block level tag's job, almost as many markup errors as there are lines of markup (the validator throwing it's hands up in disgust after the unencoded scripting), much less the vague/meaningless class names...

    Or the outright heading abuse with the nonsensical H3's (invalid heading order) in the MENU (!?!)

    Lemme guess, Dreamweaver?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •