SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    menu- switch external css & more

    hey guys. for wvmimaging.com my client decided that because much of his business is conducted on elderly folks, they might not be able to read size 2 font on the web. as a result, he asked if there is a way to make the text larger. now, it's insane to have size 3 font on a web page (especially for smaller resolution screens) so i decided to add a little feature on each page. it would be a dropdown menu with 2 choices- normal text and large text. when the user selects large text (normal is default) the entire page's text will reformat to a larger size.
    the way i plan on doing this is by changing the external style sheet that the page is pointed to. im sure it can be done, but i dont know how.
    moreover, there should be a way to remember which option the user chose so that every linked page or future page will have the same setting (the menu will still be there though). maybe using a cookie or some javascript that uses the menu name.

    can anyone help? please?

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let's try this:

    Make this be the very first CSS related thing on your page:

    <link rel="stylesheet" type="text/css" href="normalText.css" />


    Now, you can change the href in IE4+/NS6 like so:

    document.styleSheets[0].href="largeText.css";

    That help any?
    Jason - Contact Me
    Supermoderator @ CodingForums

  3. #3
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmmm thanks we're getting there. now first off is the /> on the link rel a mistake or no? secondly, i called the javascript from a text link. is that correct? cuz what seemed to happen was that all text formatting disappeared... meaning the stylesheet was disconnected without another being applied. so at least it disconnected my /assets/main.css by /assets/mainlarge.css didnt hook up (and yes i changed the location)

  4. #4
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    northern Maine
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The /> was no mistake, it is for XHTML compliancy.

    As for the new CSS not being loaded, the only thing I can think of right now is that the one you tried loading doesn't exist, check the path and filename carefully.
    Jason - Contact Me
    Supermoderator @ CodingForums

  5. #5
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope its fine. i just cant get it to work! dont understand...


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
  •