Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7004237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:10:23+00:00 2026-05-27T21:10:23+00:00

so i have this script: <script type=text/javascript> $(window).load(function () { var imagePath = new

  • 0

so i have this script:

<script type="text/javascript">
        $(window).load(function () {
            var imagePath = new String($('.give').css("background-image").toString());
            if (imagePath == "none") {
                $('.give').css("text-indent", "0px");
            }
            else if (imagePath != null) {
                var tempImage = new Image();
                tempImage.onerror = function () {
                    if (!tempImage.complete) {
                        $('.give').css("text-indent", "0px");
                    }               
                }
                imagePath = imagePath.split("images/")[1];
                imagePath = "images/" + imagePath.split(")")[0];
                imagePath = imagePath.split('"')[0];
                tempImage.src = imagePath;
            }   
        });
    </script>

i need to check if images are disabled in the browser, if they are i need to bring the text back on the screen so the app can be used without images. the first if statement handles chrome and firefox because for some reason if images are disabled they return “none” for the background css property. not the case for ie7. the second if statement attempts to handle the case for ie but for some reason neither .onload or .onerror are getting fired.

has anyone encountered this that can help? or point me in the right direction? i have tried alot ways to do this. but i just cant seem to get it to work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:10:23+00:00Added an answer on May 27, 2026 at 9:10 pm

    This is my solution:

    <script type="text/javascript">
        detectImageEnabledMode({
            onDetectImageIsDisabled:function(){
                alert('disabled');
            },
            onDetectImageIsEnabled:function(){
                alert('enabled');
            }
        });
        function detectImageEnabledMode(options){
            /* define disabled/enabled actions */
            var actionCounter = 0;
            var enabledAction = (options.onDetectImageIsEnabled && typeof(options.onDetectImageIsEnabled)=='function')?options.onDetectImageIsEnabled:function(){};
            var enaledActionRun = function(){
                if(actionCounter) return;
                actionCounter++;
                enabledAction();
            }
            var disabledAction = (options.onDetectImageIsDisabled && typeof(options.onDetectImageIsDisabled)=='function')?options.onDetectImageIsDisabled:function(){};
            var disabledActionRun = function(){
                if(actionCounter) return;
                actionCounter++;
                disabledAction();
            }
            /* create image */
            var img = new Image();
            var currentTime = (new Date()).getTime();
            if(navigator.appName.indexOf('Microsoft Internet Explorer') != -1){// ie
                img.onload = enaledActionRun;
                img.onabort = enaledActionRun;
                img.onerror = enaledActionRun;
                img.src = currentTime+'.'+currentTime+'?time='+currentTime;
                setTimeout(function(){
                    disabledActionRun();
                }, 0);
            }else if (navigator.appName.indexOf('Opera') != -1) {// opera
                img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="+'?time='+(new Date()).getTime();
                if(img.complete){
                    enaledActionRun();
                }else{
                    disabledActionRun();
                }
            }else{// other
                img.src = currentTime+'.'+currentTime+'?time='+currentTime;
                if(img.complete){
                    disabledActionRun();
                }else{
                    enaledActionRun();
                }
            }
        }
        // tested in: ff 2+, opera 9+, chrome, safari 4+, ie 6+
    </script>
    

    Live demo.
    The only problem – the minimum asynchronous in ie:

    setTimeout(function(){
     disabledActionRun();
    }, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an external JS file that I load into my HTML <script type=text/javascript
I have this script loaded on a page: (function() { window.alert('bookmarklet started'); function AjaxSuccess(data,
i have this script $content = string if(!isset($_GET['page'])){ $page = 1; } else{ $page
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can
I have this script which basically toggles a bgColor class on and off so
I have this script to generate an XML file for an RSS feed. Works
I have this script and when i try to run it, it just says
I have this script at the moment, which changes an image when a thumbnail
I have this script <?php if (!empty($_FILES)) { $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = dirname(__FILE__)
i have this script <select> <option value=1>one<img src=star.gif height=15 width=15></img> </option> </select> but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.