Web Analytics Made Easy -
StatCounter Resolution Check Script then write - CodingForum

Announcement

Collapse
No announcement yet.

Resolution Check Script then write

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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

    Comment


    • #3
      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)

      Comment


      • #4
        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; Jun 23, 2002, 02: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

        Comment


        • #5
          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!

          Comment

          Working...
          X