[TYPO3-english] including javascript code in template

Francesc Juliana sad at sdf.com
Tue May 7 09:30:38 CEST 2013


hello everybody:
I am trying to include javascript code in head of every page in order to get 
top menu working.
I use the following code in template but the code is not included in result 
pages.
Anyone knows what I am doing wrong?
Thanks in advance.

Francesc

 page.headerData.10.value (
  <script type="text/javascript"><!--//--><![CDATA[//><!--

 sfHover = function() {
  var sfEls = document.getElementById("nav").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
   sfEls[i].onmouseover=function() {
    this.className+=" sfhover";
   }
   sfEls[i].onmouseout=function() {
    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
   }
  }
 }
 if (window.attachEvent) window.attachEvent("onload", sfHover);
 //--><!]]></script>
 ) 




More information about the TYPO3-english mailing list