border properties...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrboyer79
    New Member
    • Dec 2006
    • 13

    border properties...

    hey all,

    i have this line of code:

    document.getEle mentById("MESSA GE").innerHTM L = total + " out of 24";

    total is a variable that calculates the number of characters typed into a field. i need to have a red box appear around the total + " out of 24" if the total is > 24. here's what i have so far:

    if ( total > 24 )
    {
    document.getEle mentById("MESSA GE").innerHTM L = "<span style='border: 1px solid red; padding: .5em>" total + " out of 24</span>";
    }
    else
    {
    document.getEle mentById("MESSA GE").innerHTM L = total + " out of 24";
    }

    this is obviously wrong because when the page loads i lose the "total out of 24" entirely. i'm pretty sure i'm just having syntax issues, but please advise!!

    thanks...
  • scripto
    New Member
    • Oct 2006
    • 143

    #2
    If "MESSAGE" is a TextBox that could be the problem. Instead of a Texbox, try using a <DIV> - that will handle the innerHTML

    Comment

    • mrboyer79
      New Member
      • Dec 2006
      • 13

      #3
      Originally posted by scripto
      If "MESSAGE" is a TextBox that could be the problem. Instead of a Texbox, try using a <DIV> - that will handle the innerHTML
      it actually is a div: <div id="message"><d iv>

      Comment

      • scripto
        New Member
        • Oct 2006
        • 143

        #4
        then here you go - this seems to work well

        document.getEle mentById("messa ge").innerHTM L = total + " out of 24";
        document.getEle mentById("messa ge").style.bord er="1px solid red";
        document.getEle mentById("messa ge").style.padd ing=".5em";

        Comment

        • mrboyer79
          New Member
          • Dec 2006
          • 13

          #5
          Originally posted by scripto
          then here you go - this seems to work well

          document.getEle mentById("messa ge").innerHTM L = total + " out of 24";
          document.getEle mentById("messa ge").style.bord er="1px solid red";
          document.getEle mentById("messa ge").style.padd ing=".5em";
          worked like a dream. thanks!

          Comment

          Working...