By pan69 on
Hi. I'm using the drupal_add_js API function in my nodes to add specific Javascript to the page where that node is being displayed but there seems to be a little problem I'm not able to figure out.
When do this:
drupal_add_js( "var i = 0;", "inline", "header" );
I see this in my HTML page:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var i = 0;
//--><!]]>However, when I place this in my header:
drupal_add_js( "var i = 0;", "inline", "header" );
drupal_add_js( "var j = 1;", "inline", "header" );I see this in my page:
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var i = 0;
//--><!]]>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var j = 1;
//--><!]]>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var i = 0;
//--><!]]>
<script type="text/javascript">
<!--//--><![CDATA[//><!--
var j = 1;
//--><!]]>Both drupal_add_js function calls are printed twice. If I would add a third drupal_add_js it will triple.
Does anyone knows whats going on?
Thanks,
Luke
Comments
No ideas? Anyone?
No ideas? Anyone?
I'm having a similar problem
I'm having a similar problem at the moment, not real sure what the cause is.
"ditto"
Me also.
I have the same problem
I have the same problem
I got the same problem will
I got the same problem will this not fixed ?