Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder ajetrumpet's Avatar
    Join Date
    Jul 2009
    Location
    Iowa City, IA
    Posts
    407
    Thanks
    44
    Thanked 5 Times in 5 Posts

    Changing H1 Header Text

    Hello all,

    I am looking for a way to dynamically change the text of a header. it is a level 1 header, and I want to change the text in it dynamically, on click of an image. I have done this with other attributes of div images, by using this code for example:
    Code:
    document.getElementById("pic1").style.backgroundColor = 'rgb(255,0,0)'
    what i need is something like this i think:
    Code:
    document.getElementById("HEADER ID").TEXT = "HEADER TEXT HAS CHANGED"
    i'm not sure what the "text" attribute should be. i know ''text'' is not right. i've tried others too...like innerText, Caption, Value. I've googled the heck out of this, and can't get anywhere. a push in the right direction appreciated! thanks!
    Last edited by Apostropartheid; 07-17-2009 at 09:51 PM.

  • #2
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    innerHTML

    Details here
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • Users who have thanked jerry62704 for this post:

    ajetrumpet (07-18-2009)

  • #3
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    document.getElementById("HEADER_ID").firstChild.nodeValue = "Header text here";
    I am still learning English


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •