Lunarpages Web Hosting Forum

Author Topic: Need help trying to get 2 scripts to work on the page  (Read 1076 times)

Offline summersong

  • Space Explorer
  • ***
  • Posts: 6
Need help trying to get 2 scripts to work on the page
« on: January 06, 2004, 05:37:20 PM »
I have a circling text trail on my page.  I want to add script for a top navigation menu; but when I do, the cursor trail no longer works.  I know there's a conflict, but can't seem to resolve it.   Can anyone help?  Many thanks.

The scripts are:

Navigation loaded in <BODY>:

<script language="JavaScript" src="../menu2.js"></script>
<script language="JavaScript" src="../menucontext2.js"></script>
<script language="JavaScript">
showToolbar();
</script>
<script language="JavaScript">
function UpdateIt(){
if (ie&&keepstatic&&!opr6)
document.all["MainTable"].style.top = document.body.scrollTop;
setTimeout("UpdateIt()", 200);
}
UpdateIt();
</script>


Cursor trail loaded in <HEAD>:

<SCRIPT LANGUAGE="JavaScript1.2">
<!--//

//Circling text trail- Tim Tilton
//Website: http://www.tempermedia.com/
//Visit http://www.dynamicdrive.com for this script and more

// your message here
var msg='~REJOICE AND GIVE THANKS~';

var font='Arial';
var size=3; // up to seven
var color='#D9E6DC';

// This is not the rotation speed, its the reaction speed, keep low!
// Set this to 1 for just plain rotation w/out drag
var speed=.3;

// This is the rotation speed, set it negative if you want
// it to spin clockwise
var rotation=.2;

// Alter no variables past here!, unless you are good
//---------------------------------------------------

var ns=(document.layers);
var ie=(document.all);
var msg=msg.split('');
var n=msg.length;
var a=size*15;
var currStep=0;
var ymouse=0;
var xmouse=0;
var scrll=0;
var props="<font face="+font+" size="+size+" color="+color+">";

if (ie)
window.pageYOffset=0

// writes the message
   if (ns){
   for (i=0; i < n; i++)
      document.write('<layer name="nsmsg'+i+'" top=0 left=0 height='+a+' width='+a+'><center>'+props+msg+'</font></center></layer>');
   }
   if (ie){
      document.write('<div id="outer" style="position:absolute;top:0px;left:0px"><div style="position:relative">');
      for (i=0; i < n; i++)
         document.write('<div id="iemsg" style="position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center;font-weight:regular;cursor:default">'+props+msg+'</font></div>');
         document.write('</div></div>');
   }
   (ns)?window.captureEvents(Event.MOUSEMOVE):0;

function Mouse(evnt){
   ymouse = (ns)?evnt.pageY+20-(window.pageYOffset):event.y; // y-position
   xmouse = (ns)?evnt.pageX+20:event.x-20; // x-position
}

if (ns||ie)
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
y=new Array();
x=new Array();
Y=new Array();
X=new Array();
for (i=0; i < n; i++){
   y=0;
   x=0;
   Y=0;
   X=0;
}

function makecircle(){ // rotation properties
if (ie) outer.style.top=document.body.scrollTop;
currStep-=rotation;
   for (i=0; i < n; i++){ // makes the circle
      var d=(ns)?document.layers['nsmsg'+i]:iemsg.style;
      d.top=y+a*Math.sin((currStep+i*1)/3.8)+window.pageYOffset-15;
      d.left=x+a*Math.cos((currStep+i*1)/3.8)*2; // remove *2 for just a plain circle, not oval
   }
}

function drag(){ // makes the resistance
   scrll=(ns)?window.pageYOffset:0;
   y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
   x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
   for (var i=1; i < n; i++){
      y=Math.round(Y+=(y[i-1]-Y)*speed);
      x=Math.round(X+=(x[i-1]-X)*speed);

   }
   makecircle();
   // not rotation speed, leave at zero
   setTimeout('drag()',10);
}


// -->
</SCRIPT>

Offline Boris

  • Master Jedi
  • *****
  • Posts: 1010
    • http://www.phantomflow.com
Need help trying to get 2 scripts to work on the page
« Reply #1 on: January 11, 2004, 02:29:24 PM »
How does your <body> tag look like? Did you use a <body onload=""> function inside it?
Questions on graphics? Visit the lunarpages Graphics forum!

Bugging Danielle daily since 2003.

Have a Lunar Day!

Offline dragon6

  • Trekkie
  • **
  • Posts: 12
mouse trail
« Reply #2 on: June 04, 2004, 10:05:45 AM »
I have the same problem. Can anyone help??