JS in HTML blocks, how can i make it work right

i am trying to add rotating javascript image links to HTML blocks and the code gets changed somewhere.

same with the php codes i tried to use to do this.

the default HTML editor, which coincidentally appears to be a javascript file? i think? .js

 

the HTML editor adds characters to the code. 

 

can i change this somehow is there a trick to force the Javascript on the page to load correctly?

i need to ask someone who knows what i should do to make javascript work correctly.

it displays the image but uses the wrong link, it links to a folder in my admin area.

Quote · 1 Jul 2008

It will be good to place the javascript in the head tag. and you can call it from other place.

----
Quote · 3 Jul 2008

which head tag though?

since this is php im not so familiar with any head tags like HTML pages

i use this JS inserted into a table of boxes and it works fine on one of my sites made with frontpage.

 

 

i attempt to use it with dolphin and somehow something is changing the image link location.

so i dont know, if i knew WHICH pages to put this in the header tag i would try doing that of course.

the few i tried didnt work either.

 

below is how the image link looks after its changed.

(thats just the very end of the code where its changed)

 

 

var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href="+" mce_href="/profiles/admin/+""'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" mce_src="/profiles/admin/'+myimages[ry]+'" border=0></a>')
}
random_imglink()
//-->

Quote · 4 Jul 2008

oops i meant to add some things in there.

the code works but it appears tiny mce is editing the image link location.

perhaps if the function was called at page load (inserting it into head tag i guess)

or the random image link function is already defined by tiny MCE in the scripts/functions file ?

i just dont know whyyyyyyyyyyy!

 

*bangs head on desk*

Quote · 4 Jul 2008

Head tag will be in the file templates/base/_header.html

add inside

<head></head>

----
Quote · 5 Jul 2008

nopes!

this did not work either.

 putting the rotation code in the in the header.html of the template doesnt allow me to call it from the html block.

the javascript code doesnt work from the html blocks.

it just prints to the screen.

 

 

Quote · 11 Jul 2008

nopes!

this did not work either.

putting the rotation code in the in the header.html of the template doesnt allow me to call it from the html block.

the javascript code doesnt work from the html blocks.

it just prints to the screen.

Would it work within an iframe?

There are none so blind as those that will not see.
Quote · 11 Jul 2008

You can use that script anywhere in that page.

----
Quote · 13 Jul 2008

Please note, using JS at page very not safe, and if you decide to use it-  don`t allow members to put own JS code

Quote · 14 Jul 2008
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.