SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast vischo's Avatar
    Join Date
    Mar 2003
    Location
    Chicago, IL
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript to change font

    I am looking for some script help. I have a script that I use now, however, it does not work in NS7. I would like a script that changes the font family by name, onclick, of all paragraphs, links, and such within a page.

    Here is what I currently use:

    Code:
    function fontChange(face){
     document.all("main").style.fontFamily = face;
     setCookie("face", face);
    }
     
    onclick="fontChange('verdana')"
    I also use a similar method to change the font color, again only works in IE, would like a script to work in NS7.

    Thanks,

  2. #2
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your script is IE specific and not W3C specific - use this instead 8)

    Code:
    document.getElementById('main').style.fontFamily = face;

  3. #3
    SitePoint Enthusiast vischo's Avatar
    Join Date
    Mar 2003
    Location
    Chicago, IL
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Didn't even realize until you pointed it out, thanks.


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
  •