SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  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 and Netscape7

    I am working with a JavaScript function to change the font size of certain elements within a webpage, dynamically. (accessibility) The code works fine with IE6 but doesn't act in Netscape 7 (no errors).

    Code:
    function changeFontsize(size) {
     var para = document.getElementsByTagName( 'p' );
     for ( var p, i = 0; ( p = para[i] ); i++ )
     {
      p.style.fontSize = size;
     }
     var tds = document.getElementsByTagName( 'td' );
     for ( var td, i = 0; ( td = tds[i] ); i++ )
     {
      td.style.fontSize = size;
     }
     var as = document.getElementsByTagName( 'a' );
     for ( var a, i = 0; ( a = as[i] ); i++ )
     {
      a.style.fontSize = size;
     }
     setCookie("size", size);
    }
     
     
    Font Size<br />
     <a href="#" title="decrease" onclick="javascript: changeFontsize('11px');">small</a> | <a href="#" title="increase" onclick="javascript: changeFontsize('14px');">large</a> | <a href="#" title="reset" onclick="javascript: changeFontsize('12px');">reset</a>
    Any suggestions.

  2. #2
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works fine for me in Mozilla 1.3, provided I lose the space between "java" and "script" in the "java script:..."


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
  •