Changing a text variable.

Discussion in 'JavaScript' started by xLostSoulx, Feb 1, 2008.

  1. #1
    Hello, I have a banner on my website and I wish to be able to change the text inside of that banner. (the text is not within the image) Is it possible to change the variable's text to something else when a link is clicked?

    I have tried:

    document.getElementById('title').value='Lost Password';

    One problem is that "title" is a <a id='title'>Home</a> but on a different page. Example:

    The above code is in an iframe, and the <a name='title'> is on a page which has the iframe included. I hope you understand that.

    So, does anybody know how I can change the "a id" from Home to Lost Password? I will have to do this for ever page, but it's okay if I can get this to work.

    I hope you understand what I mean. Thank you.
     
    xLostSoulx, Feb 1, 2008 IP
  2. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I've made an example of what I think you were trying to accomplish, and uploaded it to my website, there is a download link on the page (sorry didn't want to post all of the source). I use a DIV tag, but this will work the same for an A tag as well, that or you can keep the div tag and just change the text to <a href="">Lost pass</a>, pass that through to the JS function in the example. Also remember to change the element names.

    http://bubblecoder.com/xLostSoulx/
     
    ToddMicheau, Feb 3, 2008 IP