Page 1 of 1

How to use or call tags ( or global content blocks) in Javascript?

Posted: Wed May 09, 2007 12:21 pm
by madaha
Here is the script ( floater layers). It show "{global_content name='footer'}" instead of content of the "footer". How do I modify it?

-------------------------
lastScrollY=0;
function ad(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
    {/*Netscape stuff*/}

//alert(diffY);
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);

document.getElementById("ad1").style.top=parseInt(document.getElementById

("ad1").style.top)+percent+"px";
document.getElementById("ad2").style.top=parseInt(document.getElementById

("ad1").style.top)+percent+"px";

lastScrollY=lastScrollY+percent;
//alert(lastScrollY);
}
ad1code="{global_content name='footer'}"

ad2code=""
document.write(ad1code);
document.write(ad2code);
window.setInterval("ad()",1);
-------------------

Re: How to use or call tags ( or global content blocks) in Javascript?

Posted: Wed May 09, 2007 5:07 pm
by Pierre M.
Hello madaha,

otherwise I've missed something, calling a UDT or a GCB from javascript is nonsense : the tag/bloc engine is on the web site and the script is inside the browser. Browser side scripts messes things after the UDT and GCB have been called/rendered.

Pierre M.

Re: How to use or call tags ( or global content blocks) in Javascript?

Posted: Sun Sep 09, 2007 10:52 pm
by calguy1000
Pierre is correct

GCB's and UDT's etc. are 'server side' scripts, not 'client side'.

If, youre doing some ajaxy thing and want to call a GCB or a UDT via XMLHTTP and then replace the contents of a DIV with the results of that call, well we can help with that.

But, by a quick scan of the javascript below that's not what you're tryiing to accomplish.