Results 1 to 6 of 6

Thread: Help modifying a script

  1. #1
    Join Date
    Sep 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help modifying a script

    script:
    http://www.dynamicdrive.com/dynamicindex9/info3.htm

    Is there any way this script (screen resolution redirect) can be altered to modify the text size based on the users screen resolution, instead of moving the user to a different page... similar to the way the document text sizer does below?

    script
    http://www.dynamicdrive.com/dynamicindex9/textsizer.htm

    Thanks,
    smoketer

    FYI: The page that I want to affect is the bottom frame shown here:
    http://www.citlink.net/~byrdfamily
    Last edited by smoketer; 09-25-2005 at 04:07 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 should be able to just install both scripts on the page. Put the text sizer script first on the page (above the screen res detector), so that its functions will be available to the screen res detector. Then modify the screen res detector substituting:
    Code:
    onload=function(){ts('body',1)}
    or:
    Code:
    onload=function(){ts('body',-1)}
    or:
    Code:
    return;
    for the statements like this one:
    Code:
    window.location.replace("http://www.netscape.com")
    The first one makes text larger, the second makes it small. Using 'return;', won't do anything at all except exit the script but, might be just the ticket for certain resolutions. Also, if you need things to get even bigger use:
    Code:
    onload=function(){ts('body',2)}
    I think you can see that using -2 will then make things even smaller than -1. There are limits to how large/small a number you can use but 3 and -3 should be OK too, if you need them. Beyond that, the change in text size would probably be too great for any practical use.

    One other thing, the text sizer script can be touchy. Install it alone on the page first to see if it is compatible with your markup.
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks! This works perfectly. I have applied the script's to the page and modified the graphics a bit to make the picture look ok but it works great!

    Question... is there an entry that I could use that would specify if the screen size isn't shown then just use the default size specified in the html code?

  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

    That would be here:
    Code:
    else //if all else
    window.location.replace("http://google.com")
    You could change it to:
    Code:
    else //if all else
    return;
    Or just eliminate the two lines altogether. Either way, screen resolutions not detected would serve the page 'as is'. There are a couple of problems though. What browser are you using? In FF it looked and worked well but, in IE it throws an error on:
    Code:
    if (screen.width==800||screen.height==600) //if 800x600
    onload=function(){ts('body',1.5)}
    I'm pretty sure that it is the 1.5 that it doesn't like. Just 1 would probably be OK. Also, using 2 for the font size in IE seems a bit big (but, not out of the question) at 1024x768 resolution (fine in FF).

    Generally, it is best to let surfers use their own resolutions though. Typically, in IE with a 800x600 resolution, folks are already surfing at -1 (smaller on their 'view menu') font size. It is the default for browsers installed on machines with that resolution. Similarly for other browsers but, in that case users have generally set their own preferred font size as, these other browsers are almost always add-ons.
    - John
    ________________________

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

  5. #5
    Join Date
    Sep 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm using IE. Both resolutions seem to look ok on my end

    The purpose is to try and make the page look "similar" in both of the major resolutions without creating two entirely separate pages. In this way I can be sure that if I add text in 800 x 600 then it will also look the same in 1024 x 768, or at least close enough that I wouldn't have to redesign two pages.

    I thought about making everything smaller, but any pictures or graphics that I would add would be so small at 1024 x 768 that there would almost not be a point in adding them.

    If you have any suggestions I would love to hear them.

  6. #6
    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

    My thought is that the page will look similar in all resolutions if the users having those resolutions have their browsers configured in a sensible fashion, which is much more often the case than not. By taking matters into your own hands, the majority of users not using the resolution you designed the page for will see either text that is too large or too small. Additionally, there are many other resolutions out there. Due to these facts, I would never do something like this for a professional job unless the client demanded it over my repeated objections. I apologize for not pointing this out in the first place but, my initial reaction is usually not to question what people want or why they want it. I would suggest just letting the page be however it will be and not bothering with these two scripts.
    - 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
  •