Crossing HTML and Javascript Barrier with Variables

Discussion in 'HTML & Website Design' started by johnwerry, Jun 19, 2007.

  1. #1
    How can I set the <TITLE> tag with a variable that I set in Javascript. Something like this:

    <SCRIPT type=text/javascript>
    var doctitle = "test title"
    </SCRIPT>
    <TITLE>doctitle</TITLE>

    I do not want to use document.title from within the Javascript. It doesn't behave the same as using <TITLE> tag.

    How do I get the variable to "live" outside the confines of SCRIPT? How do I refer to it within the <TITLE> tag?

    Thanks
     
    johnwerry, Jun 19, 2007 IP