Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Resolution Check Script then write

    I need a script that checks resolution and if the resoulution is 800by 600 it will insert image a
    if resultion is 1024 by768 it will insert image b
    Any help would be great thanks

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Colorado, USA
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Internet search for "resolution sniffer" produced DHTML Shock - Other - Resolution Sniffer specifically for 800 x 600 and 1024 x 768 resolutions to redirect with instructions.
    Editor; FrontPage 2002 (included in Office XP). Personal Operating System; Windows XP and ME. Browsers; Latest versions, NN, IE and Opera. Server running; RedHat Linux 7.2

  • #3
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Not quite

    I appreciate the post but that isnt what Im looking for.
    I need a javascript that will document write based on resolution settings.
    I dont know javascript but this is what I want it to do.
    If resoultion is 800 by 600 document write (pic url)
    If resolution is 1024 by 768 document write (alt pic url)

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Colorado, USA
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok I have a simpler script that I tested in the three browsers in my sig and at both resolutions.

    <SCRIPT LANGUAGE="JavaScript1.2">
    <!-- Begin
    if (screen.height >= 768 && screen.width >= 1024) {
    document.write("<img src='imagea.jpg' width=512 height=384 border=0>");
    }
    else {
    if (screen.height == 600 && screen.width == 800) {
    document.write("<img src='imageb.jpg' width=304 height=204 border=0>");
    }
    }
    // End -->
    </script>

    Just replace the current image tag in your page scripting with the above script changing the imagea.jpg and the width=512 height=384 to fit your "a" image in your root folder for the 786/1024 statement and the same for the 600/800 statement with your "b" image specifications.

    Note: Must change your monitor resolution to preview the result as it goes by the real monitors resolution set and not a web editors screen size emulation.

    Same script as used for full path url.

    <SCRIPT LANGUAGE="JavaScript1.2">
    <!-- Begin
    if (screen.height >= 768 && screen.width >= 1024) {
    document.write("<img src='http://your-web-site-address-here.com/imagea.jpg' width=512 height=384 border=0>");
    }
    else {
    if (screen.height == 600 && screen.width == 800) {
    document.write("<img src='http://your-web-site-address-here.com/imageb.jpg' width=304 height=204 border=0>");
    }
    }
    // End -->
    </script>

    Edit: for small scripting syntax typo.
    Last edited by newmate; 06-23-2002 at 07:39 PM.
    Editor; FrontPage 2002 (included in Office XP). Personal Operating System; Windows XP and ME. Browsers; Latest versions, NN, IE and Opera. Server running; RedHat Linux 7.2

  • #5
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Perfect!

    This is exactly what I had in my head. I knew I saw document write based on resolution in scripts before. FOr isntance "Y our using a 800 by 600 resolution" So i fgured it could be done. Thanks for the help!


  •  

    Posting Permissions

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