+ Reply to Thread
Results 1 to 18 of 18

Thread: Editing a Script
      
   

  1. #1
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Editing a Script

    Hi there,

    Just wondering if anyone knows how to edit the following script. It is for a pair of spooky eyes that follow your cursor, problem is.............I use several layers of backgrounds and images on my page, therefore the eyes end up behind the background/image.

    I have tried to alter the script myself, however no-go. I'm not sure exactly or if it can be "altered" to have the eyeballs on top of the background/image.

    Thanks to all who respond.

    The Script:

    <script language="JavaScript">
    //Watching Eyes script- By Kurt (kurt.grigg@virgin.net)
    //Script featured on Dynamic Drive
    //Visit http://www.dynamicdrive.com for this script and more
    pic0=new Image();
    pic0.src="eye.gif";
    pic1=new Image();
    pic1.src="pupils.gif";
    var n4=(document.layers);
    var n6=(document.getElementById&&!document.all);
    var ie=(document.all);
    var O=(navigator.appName.indexOf("Opera") != -1)?true:false;
    var _d=(n4||ie)?'document.':'document.getElementById(" ';
    var _a=(n4||n6)?'':'all.';
    var _r=(n6)?'")':'';
    var _s=(n4)?'':'.style';
    if (n4){
    document.write('<layer name="eyeball" top=0 left=0 width="69" height="34"><img src="eye.gif" width="69" height="34"></layer>');
    document.write('<layer name="pupil1" top=0 left=0 width="13" height="13"><img src="pupils.gif" width="13" height="13"></layer>');
    document.write('<layer name="pupil2" top:0 left=0 width="13" height="13"><img src="pupils.gif" width="13" height="13"></layer>');
    }
    else{
    if (ie)
    document.write('<div id="ic" style="position:absolute;top:0;left:0"><div style="position:relative">');
    document.write('<div id="eyeball" style="position:absolute;top:100px;left:100px;widt h:69px;height:34px"><img src="eye.gif" width="69" height="34"></div>');
    document.write('<div id="pupil1" style="position:absolute;top:0px;left:0px;width:12 px;height:13px"><img src="pupils.gif" width="13" height="13"></div>');
    document.write('<div id="pupil2" style="position:absolute;top:0px;left:0px;width:12 px;height:13px"><img src="pupils.gif" width="13" height="13"></div>');
    if (ie)
    document.write('</div></div>');
    }
    var ym=0;
    var xm=0;
    if (n4||n6){
    window.captureEvents(Event.MOUSEMOVE);
    function mouseNS(e){
    ym = e.pageY-window.pageYOffset;
    xm = e.pageX;
    }
    if (n4)window.onMouseMove=mouseNS;
    if (n6)document.onmousemove=mouseNS;
    }
    if (ie||O){
    function mouseIEO(){
    ym = (ie)?event.clientY:event.clientY-window.pageYOffset;
    xm = event.clientX;
    }
    document.onmousemove=mouseIEO;
    }
    var etemp=eval(_d+_a+"eyeball"+_r+_s);
    var p1temp=eval(_d+_a+"pupil1"+_r+_s);
    var p2temp=eval(_d+_a+"pupil2"+_r+_s);
    dy=0;
    dx=0;
    fy=0;
    fx=0;
    angle1=0;
    angle2=0;
    d1=0;
    d2=0;
    function makefollow(){
    sy=(!ie)?window.pageYOffset:0;
    wy=(ie)?document.body.clientHeight:window.innerHei ght;
    wx=(ie)?document.body.clientWidth:window.innerWidt h;
    //Keep eyes on screen. Netscape 6 plays up otherwise!
    var chy=Math.floor(fy-34);
    if (chy <= 0) chy = 0;
    if (chy >= wy-34) chy = wy-34;
    var chx=Math.floor(fx-34);
    if (chx <= 0) chx = 0;
    if (chx >= wx-69) chx = wx-69;
    etemp.top=chy+sy;
    etemp.left=chx;
    //eyeball1 centre.
    c1y=parseInt(etemp.top)+17;
    c1x=parseInt(etemp.left)+17;
    //eyeball2 centre.
    c2y=parseInt(etemp.top)+17;
    c2x=parseInt(etemp.left)+52;
    dy1 = ym+sy - c1y;
    dx1 = xm - c1x;
    d1 = Math.sqrt(dy1*dy1 + dx1*dx1);
    dy2 = ym+sy - c2y;
    dx2 = xm - c2x;
    d2 = Math.sqrt(dy2*dy2 + dx2*dx2);
    ay1 = ym+sy - c1y;
    ax1 = xm - c1x;
    angle1 = Math.atan2(ay1,ax1)*180/Math.PI;
    ay2 = ym+sy - c2y;
    ax2 = xm - c2x;
    angle2 = Math.atan2(ay2,ax2)*180/Math.PI;
    dv=1.7;
    p1temp.top=(d1 < 17)?(c1y-6+d1/dv*Math.sin(angle1*Math.PI/180)):(c1y-6+10*Math.sin(angle1*Math.PI/180));
    p1temp.left=(d1 < 17)?(c1x-6+d1/dv*Math.cos(angle1*Math.PI/180)):(c1x-6+10*Math.cos(angle1*Math.PI/180));
    p2temp.top=(d2 < 17)?(c2y-6+d2/dv*Math.sin(angle2*Math.PI/180)):(c2y-6+10*Math.sin(angle2*Math.PI/180));
    p2temp.left=(d2 < 17)?(c2x-6+d2/dv*Math.cos(angle2*Math.PI/180)):(c2x-6+10*Math.cos(angle2*Math.PI/180));
    }
    function move(){
    if (ie)ic.style.top=document.body.scrollTop;
    dy=fy+=(ym-fy)*0.12-2;
    dx=fx+=(xm-fx)*0.12;
    makefollow();
    setTimeout('move()',10);
    }
    window.onload=move;
    //-->
    </script>

  2. #2
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    on each image that it goes behind right click the image and click the move to back, that should work for you. no need to change the script

  3. #3
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    Perfect

    Thank-you Aliens!

  4. #4
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    had the same problem with the elastic balls

  5. #5
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    dame that quick ( spooky )

  6. #6
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    lol Aliens......elastic balls?

    Jeez.........worked on this all last night and part of today.......it didn't work. When you have a moment.......any other suggestions?

    Here is the link: http://costumesrus.net/creeps1.html

  7. #7
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    OK my friend zip the page and any of the images plus the script or the link to the place you got from and email it to me. and i will sort it.

  8. #8
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    Thanks Aliens for taking the time to do this..........

    "You have mail!"

  9. #9
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    Ah CL you forgot the BV page and the images you have on it.

  10. #10
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    Sorry about that Aliens,

    It's on the way........thanks!

  11. #11
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    i will try and get it back to you some time sunday

  12. #12
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    Ok, thanks once again. Phew! For a minute I thought you were going to tell me I didn't send the right file again. When you have some spare time Aliens........that's fine for me. Appreciate it!

    ty

  13. #13
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    Ok Robyn
    bear in mind that i have not got the images that you have on the page.
    http://www.aliensanonymous.org/creeps.html

  14. #14
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    Garry,

    You're a genius! Thank-you! It Works now!


  15. #15
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    Strange can't see it in the link above.

  16. #16
    C L's Avatar
    C L
    C L is offline General
    Join Date
    Jul 2006
    Location
    Broomstick
    Posts
    5,561

    Wink Re: Editing a Script

    err.....I think that was my fault, somehow I mixed up the name of the page with the name of the folder, however you did get the proper images to the other page and you made the script work ..........that page you posted was to this page: http://costumesrus.net/creeps.html .......don't ask me how I did that, I'm sure I don't remember.......it was late, I started making a few mistakes, finally had to give it up for the night..........optimizing everything on my website, alot of pics etc...........phew! Might be done this time next year. Thanks again Garry, you're awesome with this script stuff...........

  17. #17
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script

    No Problem any time.

  18. #18
    Aliens Anonymous is offline Special Status
    Join Date
    Jan 2006
    Location
    Dark side of the moon
    Posts
    1,161

    Default Re: Editing a Script


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49