Jump to content

Mouse over things


Fire Dragon

Recommended Posts

I want make image what makes browser window shaking,when mouse is over it,and when it isn't over it,it don't shake it.Another mouse over question,I want make image what plays sound,when mouse is over it.How?These must work with firefox,so I can test them.I had shaking code,but I lost it,and forget it(silly me :) )so it would be nice,if you can tell it too.I must continue searching that code clip...

Link to comment
Share on other sites

<head>              <script language="JavaScript" type="text/javascript">               function init() {               setTimeout("shake(3)",1000);               setTimeout("this.focus()",4000);               setTimeout("shake(3)",4100);               }               function register()               {               var isAol = "no";               var res = 800;               }               function shake(n) {               if (self.moveBy) {               for (i = 10; i > 0; i--) {               for (j = n; j > 0; j--) {               self.moveBy(0,i);               self.moveBy(i,0);               self.moveBy(0,-i);               self.moveBy(-i,0);                     }                   }                 }               }               a=275;               b=275;               r=20;               x=1;               z=1;               function rotate(r) {               while (z<=3) {               for (var i = 0; i <360; i++) {               x = (r * Math.cos((i * Math.PI)/180)) + a;               y = (r * Math.sin((i * Math.PI)/180)) + b;               window.moveTo(x,y);               }               z+= 1;               }               setTimeout("shake(3)",10000);               }                </script></head><body ONLOAD="init()"></body>

Link to comment
Share on other sites

I tried that code,but it wont work.I may set image code wrong place.Iput IMG src="flygon.gif" in body part.It creates picture,but when I move mouse over it,nothing happens.I just think,I can make that shaking is function,and when mouse is over picture,it calls that event(like in that code before),but I don't know what is mouse overs code,like "mouse click" code,when you click object.Help?I just looked code again,and it works,but strangely.It shakes only some times,and it also resizes browser window.Help!

Link to comment
Share on other sites

This attribute ONLOAD="init()" controls when the shaking occurs. When ever you resize the browser, it will run the function since the body tag is revisited.So, take the ONLOAD="init()" attribute out of the <body> tag and add it to the <img>. Then change the ONLOAD to ONMOUSEOVER and you should be set.

Link to comment
Share on other sites

This attribute ONLOAD="init()" controls when the shaking occurs.  When ever you resize the browser, it will run the function since the body tag is revisited.So, take the ONLOAD="init()" attribute out of the <body> tag and add it to the <img>.  Then change the ONLOAD to ONMOUSEOVER and you should be set.

Thanks,it works now nice,but it shakes only sometime.I want it continues shaking as long,that mouse is over it.How I can do that?Sorry,if I'm too beginner... :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...