Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By gurukripa on
Hi
theres a lot of nice Javascript around with animations etc which can be incorporated into a Drupal site to make things look better than they are.
I tried to do this, but failed.
I tried to add some code which looks like this and failed....can someone suggest why this is so..doesnt Drupal allow Javascript to be put in...i tried changing Input filters...even php didnt work..pls help...thanks
I am using Drupal 5.1 with Fancy theme
the code is below.
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<!--Goes between <HEAD> & </HEAD> tags-->
<!--You may keep it, change or ignore it!-->
<style type="text/css">
.tab { font-weight:bold; font-size:12px; font-family:Arial;}
A.tab:link {color:blue;}
A.tab:visited{color: blue;}
A.tab:hover {color: red;}
</style>
<!--Goes between <HEAD> & </HEAD> tags-->
<script language=javascript>
//************************************************
//* http://members.rogers.com/bazil/scroller.htm *
//************************************************
// Parameters of the Blinker follow:
//=================================
//width
var mswidth=200
//height
var msheight=55
//message pause: message in sight!
var mspause=500 //1000=1s
//blinks speed: message out of sight!
var msspeed=400 // 1000=1s
var msblinks=5 //value from 1 up: as many blinks per message as
//you'd like; If only one message: value 0 (indefinitely).
//background color
var bcolor='#ffffff'
//Messages - as many as you'd like: change to your own!
//Within a message you must use \' in lieu of ', should the case be!
var singlemessages=new Array()
singlemessages[0]='<table align="center" border=0 CELLSPACING="0" CELLPADDING="0"><tr><td><font face=Arial color="navy"><div align="center" class=tab><u>Invite your Friends to</u></div><DIV ALIGN="CENTER" class=tab><em>www.spiritualnectar.com</em></div><div align="center" class=tab>Spread the word.</div></font></td></tr></table>'
srcpng1 = new Image();
srcpng1.src = "http://www.art-tlc.com/anim/b31.gif"
srcpng2 = new Image();
srcpng2.src = "http://www.art-tlc.com/anim/b15.gif"
srcpng3 = new Image();
srcpng3.src = "http://www.art-tlc.com/anim/b30.gif"
singlemessages[1]='<table align="center" border=0 CELLSPACING="0" CELLPADDING="0"><tr><td><img src=' +srcpng3.src+ '></td><td><div align="center"><a class=tab href="http://spiritualnectar.com/nityananda/invite"><img src=' +srcpng1.src+ '></a></div></td><td><img src=' +srcpng2.src+ '></td></tr></table>'
singlemessages[2]='<table align="center" border=0 CELLSPACING="0" CELLPADDING="0"><tr><td><div align="center"><a class=tab href="http://spiritualnectar.com/nityananda/invite"><u>Click here</u><div align="center"><u>to send</u><div align="center"><u>Invitations</u></a></div></div></div></td></tr></table>'
//...
//--end Parameters -->
//The Blinker's Algorithm follows:
//================================
var kkk=0
var timer1 = null
var timer2 = null
if (singlemessages.length==1) msblinks=0;
var resumesmsb=msblinks
iki=0
function startb(){
if (document.all){
iens6div=ieNS6sliderb
iens6marquee11()
}
else if (document.layers){
ns4layerb=document.ns4sliderb0.document.ns4sliderb1
ns4layerb.visibility='show'
ns4marquee11()
}
else if (document.getElementById){
iens6div=document.getElementById('ieNS6sliderb')
iens6marquee11(iens6div)
}
}
function iens6marquee11(){
iens6div.innerHTML=singlemessages[iki]
timer1=setTimeout("iens6marquee12(iens6div.style.top=msheight)",mspause)
if (singlemessages.length>1&&msblinks>0) msblinks--
return;
}
function iens6marquee12(){
timer2=setTimeout("iens6marquee11(iens6div.style.top=0)",msspeed)
if (singlemessages.length>1&&msblinks==0){
msblinks=resumesmsb
if (iki==singlemessages.length-1)
iki=0
else
iki++
}
return;
}
function ns4marquee11(){
ns4layerb.document.write(singlemessages[iki])
ns4layerb.document.close()
timer1=setTimeout("ns4marquee12(ns4layerb.top=msheight)",mspause)
if (singlemessages.length>1&&msblinks>0) msblinks--
return;
}
function ns4marquee12(){
timer2=setTimeout("ns4marquee11(ns4layerb.top=0)",msspeed)
if (singlemessages.length>1&&msblinks==0){
msblinks=resumesmsb
if (iki==singlemessages.length-1)
iki=0
else
iki++
}
return;
}
//--end Algorithm -->
</SCRIPT>
<!-- End of Script between <head> & </head> tags-->
</head>
<body>
<!-- Step III. Within the Body Tag itself onload event handler: -->
<body onload="startb();">
<!--Goes between <BODY ... > & </BODY> tags-->
<!-- begin: body code -->
<table align="center" border=0 CELLSPACING="0" CELLPADDING="0"><tr><td>
<ilayer id="ns4sliderb0" width=&{mswidth}; height=&{msheight}; bgcolor=&{bcolor};>
<layer id="ns4sliderb1" width=&{mswidth}; height=&{msheight}; onMouseover='if (timer1!=null){ clearTimeout(timer1); ns4layerb.top=0; kkk=1;} if (timer2!=null){ kkk=1; clearTimeout(timer2); }' onMouseout='if (kkk==1) {kkk=0; timer2=setTimeout("ns4marquee11(ns4layerb.top=0)",msspeed);}'>
</layer></ilayer>
<script language="JavaScript">
if (document.all||document.getElementById){
document.writeln('<div style="position:relative;overflow:hidden;width:'+mswidth+';height:'+msheight+';clip:rect(0 '+mswidth+' '+msheight+' 0);background-color:'+bcolor+';" onMouseover="if (timer1!=null){ clearTimeout(timer1);iens6div.style.top=0; kkk=1;} if (timer2!=null) {kkk=1; clearTimeout(timer2);}" onMouseout="if (kkk==1) { kkk=0; timer2=setTimeout(\'iens6marquee11(iens6div.style.top=0)\',msspeed);}">')
document.writeln('<div id="ieNS6sliderb" style="position:relative;width:'+mswidth+';height:'+msheight+';">')
document.writeln('</div></div>')
}
</script></td></tr></table>
<!-- End -->
</body>
</html>
Comments
using front page bad idea
Hi,
Using front page for inserting js code is bad idea. I suggest you to do it with notepad instead.
if you want to use php input format then need to do like this;
thanks...but u havent included rest of the code
what about the code between body tags...sorry if i am asking a stupid question....how shld that be put in php ?
not the best-practice way of doing this
body onload events are deprecated in favour of jquery syntax.
That means - even if you got that code embedded in the page (which isn't the hard part) it's unlikely to get started running.
Your js should instead be put into an included *.js library and loaded from there.
Drupal comes with jquery built in, so you are better to use sample code from that library instead of whatever you found.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
thanks dman
arent u the super cool guy who did the import html thing...pity it seemed too technical for me :(
wish it were more user friendly..i had so many thousands of nice content..i would like to pull in..plus more coming regularly...
wish u cld make it more dummy(me) friendly :)
thanks dman
Thanks dman. I noted your point.