PDA

View Full Version : onMouseover effect help.



animefreak
12-09-2004, 07:55 PM
Hello I am trying to make my whole webpage shake when i have my mouse go over a picture on that page. The only scripts i could find were for effects that would just shake the picture and not the whole page. Could someone please help me out with getting the whole page to shake?

cr3ative
12-09-2004, 08:12 PM
Hi there.
[please post in the correct forum section-thanks]

Pop this in your HEAD section:


<script language="JavaScript1.2">
function shake() {
if (parent.moveBy) {
for (i = 15; i > 0; i--) {
for (j = 2; j > 0; j--) {
parent.moveBy(0,i);
parent.moveBy(i,0);
parent.moveBy(0,-i);
parent.moveBy(-i,0);
}
}
}
}
</script>And on your pictures, make the <img src="file.jpg"> tag look like this:

<img src="file.jpg" onmouseover="shake()">

cr3ative

animefreak
12-09-2004, 09:15 PM
oops sorry im new to these forums. where should I have posted this? also i input the code you listed and it wouldnt work. Do i need to edit anything other than the name of the img file?

cr3ative
12-10-2004, 07:14 AM
Ok, I'll break it down for you.

The first chunk of code goes inbetween these two tags: <head> and </head> in the actual HTML code (Code view if you're using FrontPage).

Then, find your image tags in the HTML. They always start with <img, and when you find one of these, just before the closing >, insert onmouseover="shake()".

cr3ative
Don't worry about where to post too much, but this would have been better in the Javascript section