WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Javscript in Template = doesn't work Empty Javscript in Template = doesn't work Fri Jul 23, 2010 9:59 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
Hello!

When I'm putting this code in a template, it won't show up.
Code:
<script language="JavaScript1.2">
<!--

Cupid=new Image();
Cupid.src="http://i35.servimg.com/u/f35/14/15/79/13/tropis11.gif";  //specify path to Cupid image
amount=3;  //Number of cupids, minimum must be 3.
Xpos=700;  //cupids x coordinates, in pixel
Ypos=200;  //cupids y coordinates, in pixel
step=0.3; //Animation speed (smaller is slower)
dismissafter=15;  //seconds after which Cupids should disappear, in seconds

var ns6=document.getElementById&&!document.all
bats=new Array(3)
if (document.layers){
for (i=0; i < amount; i++)
{document.write("<LAYER NAME=n"+i+" LEFT=0 TOP=-50><a href='http://friends-venner.friendhood.net/2-Kode-h19.htm'><IMG SRC='"+Cupid.src+"' NAME='nsi' width=69 height=60 border=0></a></LAYER>")}
}
else if (document.all||ns6){
document.write('<div id="out" style="position:absolute;top:0;left:0"><div id="in" style="position:relative">');
for (i=0; i < amount; i++){
if (document.all)
document.write('<a href="http://friends-venner.friendhood.net/2-Kode-h19.htm"><img src="'+Cupid.src+'" id="msieBats" style="position:absolute;top:-50;left:0" border=0></a>')
else
document.write('<a href="http://friends-venner.friendhood.net/FEJL-h23.htm"><img src="'+Cupid.src+'" id="ns6Bats'+i+'" width=69 height=60 style="position:absolute;top:-50;left:0" border=0></a>')
}
document.write('</div></div>');
}

yBase=xBase=currStep=a_count=0;
b_count=1;
c_count=2;
d_count=3;
move=1;
if (document.layers||ns6){
yBase=window.innerHeight/3;
xBase=window.innerWidth/6;
if (document.layers)
window.captureEvents(Event.MOUSEMOVE);

}
if (document.all){
yBase = window.document.body.offsetHeight/3;
xBase = window.document.body.offsetWidth/6;
}

function dismisscupid(){
clearInterval(flycupid)
if (document.layers){
for (i2=0; i2 < amount; i2++){
document.layers['n'+i2].visibility="hide"
}
}
else if (document.all)
document.all.out.style.visibility="hidden"
else if (ns6)
document.getElementById("out").style.visibility="hidden"
}

if (document.layers){
for (i=0; i < amount; i++)
document.layers['n'+i].document.images['nsi'].src=Cupid.src
}
else if (document.all){
for (i=0; i < amount; i++)
document.all.msieBats[i].src=Cupid.src
}
else if (ns6){
for (i=0; i < amount; i++)
document.getElementById("ns6Bats"+i).src=Cupid.src
}

function Animate(){
a_count+=move;
b_count+=move;
c_count+=move;
currStep+=step;
if (a_count >= bats.length) a_count=0;
if (b_count >= bats.length) b_count=0;
if (c_count >= bats.length) c_count=0;
if (document.layers){
for (i=0; i < amount; i++) {
  var NewL="n"+i
  document.layers[NewL].top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
  document.layers[NewL].left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
  }
}

if (document.all){
for (i=0; i < amount; i++){
  document.all.msieBats[i].style.pixelTop = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
  document.all.msieBats[i].style.pixelLeft =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
 }
}

if (ns6){
for (i=0; i < amount; i++){
  document.getElementById("ns6Bats"+i).style.top = Ypos+yBase*Math.sin(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/10)
  document.getElementById("ns6Bats"+i).style.left =Xpos+xBase*Math.cos(((currStep)+i*3.7)/4)*Math.cos((currStep+i*35)/62)
 }
}

}
flycupid=setInterval('Animate()',30);
setTimeout("dismisscupid()",dismissafter*1000)
//-->
</script>

~Unknown Data



Last edited by Unknown Data on Fri Jul 23, 2010 10:54 pm; edited 1 time in total

http://woops.dk

2Javscript in Template = doesn't work Empty Re: Javscript in Template = doesn't work Fri Jul 23, 2010 10:25 pm

RockerMan

RockerMan
Technician
Technician
First problem....
Code:
<script language="JavaScript1.2">
Replace with....
Code:
<script type="text/javascript" charset="utf-8">

Second problem...
Why have you got HTML comment symbols in there?

Third problem...
You have not refrenced the jQuery library, so all that code is usless unless you give the src for the library
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

http://www.graphics-post.com/

3Javscript in Template = doesn't work Empty Re: Javscript in Template = doesn't work Fri Jul 23, 2010 10:32 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
First problem = Done

Second problem
Actually I don't really know, I've just always used it.

Third problem
All right I'm lost there, so do you know how I can find the library?

PS. Thank you so much for the help. Very Happy

http://woops.dk

4Javscript in Template = doesn't work Empty Re: Javscript in Template = doesn't work Fri Jul 23, 2010 10:43 pm

ankillien

ankillien
Administrator
Administrator
Unknown Data wrote:Second problem
Actually I don't really know, I've just always used it.

It is to prevent older browsers from going through the javascript.

Unknown Data wrote:Third problem
All right I'm lost there, so do you know how I can find the library?

You don't need to access the library. Just add the script in the template so that your pages can have jQ functions working...

Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

5Javscript in Template = doesn't work Empty Re: Javscript in Template = doesn't work Fri Jul 23, 2010 10:53 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
It is to prevent older browsers from going through the javascript.
Oh okay, thanks for share your visdom. Very Happy

You don't need to access the library. Just add the script in the template so that your pages can have jQ functions working...
Such a simple thing, could I've told my self.

Well thanks for the help both of you.

Solved | Locked

http://woops.dk

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum