SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have read the Answer to "Dynamically Display Current Site Name in Content Editor Web Part" but i do not understand why

> <script type="text/javascript" language="javascript">   
> window.onload=func1;  function func1() { var GetSiteTitle =
> document.createElement("span"); = "span1";   
> GetSiteTitle.className ="dynamicSpan";    GetSiteTitle.innerHTML = 
> document.getElementsByTagName('title')[0].innerHTML;  
> document.body.appendChild(GetSiteTitle);} </script>

is not showing anything in the CEWP. How do i get the varibale GetSiteTitle to render the title? Thanks for your help.

share|improve this question
Could you clarify your question? Is the script not loading, the title not loading, is the script disappearing or are you getting an error on the javascript variable? – Dave Wise Oct 17 '12 at 16:47
Try alerting in the script to see if the JavaScript code is being called? – Falak Mahmood Oct 17 '12 at 16:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.