SimplePortal

Customization => Custom Coding => Topic started by: Zirc on March 16, 2012, 09:57:27 PM

Title: Need help with a javascript block
Post by: Zirc on March 16, 2012, 09:57:27 PM
Hello,

I am wondering if somebody could help me display my Ventrilo Voice chat status in a block.  The code is below.  I've tried putting it in a Custom HTML block as many different ways as I can but the status never shows up when I preview.  If I put the code in a normal webpage anywhere it works just fine so I'm at a loss as to why I can't get it to work in a block.

Thanks

Code: [Select]
<script type="text/javascript" src="http://status.leetvoiceservers.net/ventstatus/status.php?server=tx3.leetvent.com:3988&tablebg=660066&headerbg=CC0000&uptimebg=000000&usersbg=000000&channelbg=000000&clientbg=000000&tableborder=660066&adminbullet=FF0000&normalbullet=00FFFF&channeltext=F0F8FF&clienttext=F0F8FF"></script>
Title: Re: Need help with a javascript block
Post by: Chen Zhen on March 16, 2012, 10:39:42 PM
Hmm.. I'm not sure if it will work when attempting a url without a .js suffix.
Anyhow, using the html to load js files should be done between the head tags of the html.
You can use some js to insert it to the head of the page.

Try this:
Code: [Select]
<script type="text/javascript">
var head= document.getElementsByTagName("head")[0];
   var script= document.createElement("script");
   script.type= "text/javascript";
   script.src= "http://status.leetvoiceservers.net/ventstatus/status.php?server=tx3.leetvent.com:3988&tablebg=660066&headerbg=CC0000&uptimebg=000000&usersbg=000000&channelbg=000000&clientbg=000000&tableborder=660066&adminbullet=FF0000&normalbullet=00FFFF&channeltext=F0F8FF&clienttext=F0F8FF";
   head.appendChild(script);
</script>
Title: Re: Need help with a javascript block
Post by: Zirc on March 16, 2012, 10:55:35 PM
 :( That didn't work either.  When I just use the code I pasted in the first post and put anywhere on an .html in the head or body page the attached picture is what is generated and that is what I am trying to put into the block.  Thats why I thought just pasting the code into a custom HTML block would work.

Title: Re: Need help with a javascript block
Post by: Zirc on March 16, 2012, 11:43:51 PM
It's working now.  Apparently scripts like this just won't show up in the preview, you actually have to save the block then reload the page for it to show up.
SimplePortal 2.3.8 © 2008-2024, SimplePortal