[Javascript] Setting title of web page

Hassan Schroeder hassan at webtuitive.com
Sun May 11 11:37:19 CDT 2008


Skip Evans wrote:
>
> I'm trying to change the actual title tag value in 
> the <head> section using the DOM. 

> So anyway, I can get the title by tag name:
> 
> var title=document.getElementsByTagName('title');
> 
> But I can't find the right arguments to pass to
> 
> setAttribute('?????','New Page Title');

That's because the title text is not an attribute of the title tag;
it's a text node child of the title element, e.g.

  <title>$content</title>

HTH,
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-621-3445   === http://webtuitive.com

                           dream.  code.



More information about the Javascript mailing list