Forum Moderators: open

Message Too Old, No Replies

Var inside Title

         

Damien3350

7:36 pm on May 24, 2004 (gmt 0)

10+ Year Member



Hi,
I was wondering if it's possible to place a variable inside a HTML page's title.
Thanks,
Damien

Birdman

8:03 pm on May 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do it a couple of ways:

1)myTitle = document.getElementsByTagName('title').item(0).innerHTML;

2)myTitle = document.getElementById('title').innerHTML;

document.write(myTitle + myVar);

Note: You will have to have an id attribute in your title tag to use the second method(eg. <title id="title">).

Birdman