Problem setting font size

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kasya
    New Member
    • Jun 2006
    • 57

    #1

    Problem setting font size

    hello
    i need help about getElementById( id) function

    function setFontSize(siz e) {
    document.getEle mentById('fonts ize').style.fon tSize = size;
    }

    is my function

    it isn't showing
    i think i used first ID inside of second ID

    the 'fontsize' is inside of 'opentable'
    1st version:
    [HTML]
    <a href='#' onclick="setFon tSize(15)">15</a>
    <table id='opentable'> <tr><td><div id='fontsize'>H ello</div></td></tr></table>[/HTML]
    2nd version
    [HTML]<a href='#' onclick="setFon tSize(15)">15</a>
    <table id='opentable'> <tr><td id='fontsize'>H ello</td></tr></table>[/HTML]



    it doesn't change
  • phvfl
    Recognized Expert New Member
    • Aug 2007
    • 173

    #2
    Originally posted by Kasya
    hello
    i need help about getElementById( id) function

    function setFontSize(siz e) {
    document.getEle mentById('fonts ize').style.fon tSize = size;
    }

    is my function

    it isn't showing
    i think i used first ID inside of second ID

    the 'fontsize' is inside of 'opentable'
    1st version:
    [HTML]
    <a href='#' onclick="setFon tSize(15)">15</a>
    <table id='opentable'> <tr><td><div id='fontsize'>H ello</div></td></tr></table>[/HTML]
    2nd version
    [HTML]<a href='#' onclick="setFon tSize(15)">15</a>
    <table id='opentable'> <tr><td id='fontsize'>H ello</td></tr></table>[/HTML]



    it doesn't change
    Hi,

    Try putting a unit after the size number e.g. 15px, 15em...

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

      This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

      MODERATOR

      Comment

      Working...