Results 1 to 3 of 3

Thread: Using an If statement in javascript to change images

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Location
    Blue Mountains NSW Australia
    Posts
    160

    Using an If statement in javascript to change images

    Sorry to ask virtually for a chunk of code, but I seem to always be missing something with javascript (i don't even know java).

    First of all i need to get the resolution of a computer with javascript. and then decide which image i should display.

    Is a nested if statement possible? and if so, what is the code/syntax?

    [this is for the banner of a website, the rest of the website is tables which work on percentage..]

    thanks in advance.
    Jack Daniels
    ICQ: 72074030
    VB 6.0

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Code:
    //get the screen resolution
    var w = screen.width;
    var h = screen.height;
    
    if (w == 1024) {
            //nested if
            if (v == 768) {
                    //do something
            }
    } else {
    
    }
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Location
    Blue Mountains NSW Australia
    Posts
    160
    Thanks mate.
    Jack Daniels
    ICQ: 72074030
    VB 6.0

Posting Permissions

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



Click Here to Expand Forum to Full Width