Loading...
 
Skip to main content

Features / Usability


Cannot get javascript to run - have tried all ways possible i think

Hi,

I have signed up to get advertising onto my site. The comany uses javascript to display the ads but I am having trouble in getting it to show using modules or the banner plugin.

I have tried the JS Plugin syntax and also tried the {literal} tags but it still not working.

This is really annoying me so if anyone can help I will very much appreicate it.

Thanks

Matt

Code:


script
rnum=Math.round(Math.random() * 100000);
ts=String.fromCharCode(60);
if (window.self != window.top) {nf=''} else {nf='NF/'};
document.write(ts+'script src="http://www.domain.com/cgi-bin/ads/ad18574a.cgi/v=2.3S/sz=120x600A|160x600A/'+rnum+'/'+nf+'RETURN-CODE/JS/">'+ts+'/script>');
/script

noscript
a href="http://www.domain.com/ads/ad18574a-map.cgi/ns/v=2.3S/sz=120x600A|160x600A/" target="_top"
img src="http://www.domain.com/cgi-bin/ads/ad18574a.cgi/ns/v=2.3S/sz=120x600A|160x600A/" border="0" alt="Click Here" / /a
/noscript

Using the JS PluginQuestion should work fine.

Copy to clipboard
{JS()} rnum=Math.round(Math.random() * 100000); ts=String.fromCharCode(60); if (window.self != window.top) {nf=''} else {nf='NF/'}; document.write(ts+'script src="http://www.domain.com/cgi-bin/ads/ad18574a.cgi/v=2.3S/sz=120x600A|160x600A/'+rnum+'/'+nf+'RETURN-CODE/JS/">'+ts+'/script>'); {JS}


However, I don't think the plugin supports the <NOSCRIPT> element. You may be better off creating a custom plugin or module.

HTH,

-RickQuestion
Need more help? Try TikiWiki for Dummies SmartiesQuestion or read my Tiki Blog or visit my UserPage


I'm not sure if this will apply to you, but this is how I got Javascript working for a custom header I made. I ended up making my own header file called custom-header.php and then in "Look & Feel", General Layout tab, I added {include file="../customer-header.php"] to load it into each page.

I only mention that because I was having all sorts of issues making Javascript work in this header. If I opened the file by itself it worked fine, but if it was displayed as the header for tikiwiki, the Javascript did nothing.

I could put simple javascript such as onclick="alert('test');" on a div, but setInterval and functions in the head did nothing

I did a ton of research and somehow ended up in header.tpl which had a line including /lib/tiki-js.js

I opened up that file, added my vars and functions to the end, saved it, and voila, my Javascript now works. I even went into Admin Mods and uninstalled the js plugin that my research lead me to and the Javascript is still working.

This may only apply to me and maybe there's a better way to do it, but I'm satisfied. All I wanted to do was having a tiny little image in my header that refreshes every 10 seconds...I wasted 3 hours trying to make it work!