Embedding Javascript into HTML Sidebar Nugget

Creating and modifying plugins.
Post Reply
Andrew@GotSoul
Regular
Posts: 8
Joined: Sun Sep 25, 2005 8:37 pm
Location: London, UK
Contact:

Embedding Javascript into HTML Sidebar Nugget

Post by Andrew@GotSoul »

Is there anyway I can use the following Javascript in an HTML sidebar nugget?
<script language="JavaScript1.2">

var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

//Specify IFRAME display attributes
var iframeprops='width=525 height=400 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"'

//Specify 7 URLs to display inside iframe, one for each day of week
var daycontent=new Array()
daycontent[1]="monday.htm" //Monday content
daycontent[2]="content/tuesday.htm" //Tuesday content
daycontent[3]="wednesday.htm"
daycontent[4]="thursday.htm"
daycontent[5]="friday.htm"
daycontent[6]="saturday.htm"
daycontent[0]="sunday.htm"

//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

var mydate=new Date()
var mytoday=mydate.getDay()

function dayofweek_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=daycontent[mytoday]
}
}

window.onload=dayofweek_iframe

</script>
Any help would be much appreciated.

Thanks,
Andrew.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Embedding Javascript into HTML Sidebar Nugget

Post by garvinhicking »

Yes! You can post JS in a HTML nugget if you set the "Disable MArkup plugins" option to true. Once you disable that, no nl2br or other transformations are appleid to your raw input.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Andrew@GotSoul
Regular
Posts: 8
Joined: Sun Sep 25, 2005 8:37 pm
Location: London, UK
Contact:

Re: Embedding Javascript into HTML Sidebar Nugget

Post by Andrew@GotSoul »

garvinhicking wrote:Yes! You can post JS in a HTML nugget if you set the "Disable MArkup plugins" option to true. Once you disable that, no nl2br or other transformations are appleid to your raw input.

Regards,
Garvin
Thanks for the help Garvin... I must of missed something :) works like a treat now.

Best Regards,
Andrew.
Post Reply