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 and Font-Size

    I have a current script that I am using to dynamically resize the font within all paragraph tags on a page. Does anybody have a simple JavaScript that will retreive the P tag and change it's font size, either up or down a few pixels?

    I would like slim code that might only work in the latest browsers. IE6 and Netscape 7 is fine.

    Thanks.

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function setParaSize( size )
    {
    	var paras = document.getElementsByTagName( 'p' );
    	for ( var p, i = 0; ( p = paras[i] ); i++ )
    	{
    		p.style.fontSize = size;
    	}
    }
    This may not be exactly what you want, but should get you going in any direction you'd like
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




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

    Great

    Works great, 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
  •