Results 1 to 4 of 4

Thread: screen resolution script ---> need tweak plz

  1. #1
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question screen resolution script ---> need tweak plz

    hello,


    i'd like to ask some questions about the following script.

    1.) you may have a spelling mistake.

    Demo: This webpage is bested viewed with screen resolution 800*600. Your current resolution is 1920*1200. If possible, please change the resolution!


    2.) can the script be tweaked to:
    if user res = your recommended res then say:{custom}
    if user res < your recommended res then say:{custom}
    if user res > your recommended res then say:{custom}

    is this possible ???

    what i would like to actually have is for the script to only kick in if the user has a lesser resolution then what i put in the script as the preferred one and then recommend they change.


    thanks....


    ____________________________________
    § Pimp of Mario's World. Hater of society. §
    Last edited by Mario_AU; 02-16-2008 at 05:55 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You're right about the typo. If I could change it I would, but I don't have access to the library.

    You've lost me here:

    Quote Originally Posted by Mario_AU View Post
    if user res = your recommended res then say:{custom}
    if user res < your recommended res then say:{custom}
    if user res > your recommended res then say:{custom}
    If you only want the script to do anything when the user's res is lower (less) than the recommended, make these changes (red) in this line:

    Code:
    if (screen.width<correctwidth||screen.height<correctheight)
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2008
    Location
    Australia
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    thanks that does improve it for me.

    what i was demonstrating with my fake code was that i wish i could give a specific message to a user based on their actual resolution.

    so if the script picks up a user as 800x600, i'd like to say something about that
    and if a user has 1280x1024 (the most popular) i'd like to tell them something else. ..and so on. so i'd like to create a custom message for each resolution and display based on the user's resolution. for example to someone using 640x480 or 800x600 i'd ask them,"can you even see this site properly ? what are you using ? a mobile phone ?" and to the most popular screen res at the moment (based on many sites tracker stats) the 1280x1024, i'd say "what's that you're using there ? a 19" lcd ??? get with the times man. 20" & 22" lcd's sell below $199" or something like that!!!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yeah, I kinda got that while I was writing my response, but decided not to bother with it because it wasn't your main question. There are various ways this could be done. If you are still interested, here's one:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    </head>
    <body>
    <div>
    <script type="text/javascript">
    function resMsg(){
    var msg, res=screen.width+'x'+screen.height;
    switch (res){
    
    case '640x480':
    msg="Message for 640x480";
    break;
    
    case '800x600':
    msg="Message for 800x600";
    break;
    
    case '1024x768':
    msg="Message for 1024x768";
    break;
    
    case '1280x1024':
    msg="Message for 1280x1024";
    break;
    
    case '1440x900':
    msg="Message for 1440x900";
    break;
    
    default:
    msg="Nice "+res+" monitor!";
    }
    
    document.write(msg);
    }
    resMsg();
    </script>
    </div>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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