Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Find screen resolution using javascript/other language e.g. 1280x1024 ??

I want to find the screen resolution using javascript so that it can load a different image in a CSS script depending on the user's screen resolution. e.g. http://khushman1.googlepages.com/gmaps-index.html

The pic is a 1024x768 pic, but I have a 1280x1024 resolution, so how do I change the code so that it loads a different picture depending on the user's resolution.

Any other language is also OK but the code should work.

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    May be this helps you

    var windowWidth = 0, windowHeight = 0;

    if( typeof( window.innerWidth ) == 'number' ) {

    //Non-IE

    windowWidth = window.innerWidth;

    windowHeight = window.innerHeight;

    } else if( document.documentElement && (

    document.documentElement.clientWidth ||

    document.documentElement.clientHeight ) ) {

    //IE 6+ in 'standards compliant mode'

    windowWidth = documen0t.documentElement.clientWidth;

    windowHeight = document.documentElement.clientHeight;

    } else if( document.body && ( document.body.clientWidth ||

    document.body.clientHeight ) ) {

    //IE 4 compatible

    windowWidth = document.body.clientWidth;

    windowHeight = document.body.clientHeight;

    }

  • bente
    Lv 4
    5 years ago

    At artwork, i take advantage of 2400x1600 and at abode 1920x1200. That for pc. i take advantage of countless resolutions for video games to song performance. I have flat panels all round, and that i always set my determination to the community determination of the panel for the clearest image that is what i detect perfect. the guy before me copyed me he's my buddy we are in college sitting next to me.

  • Anonymous
    1 decade ago

    right click on desktop >>properties>>setting>>advance>>adapter>> list modes>>choose 1024X768 and apply "" ok""

Still have questions? Get your answers by asking now.