Click to See Complete Forum and Search --> : on browser window release...
boobourne
03-10-2005, 05:41 AM
Can anyone help? I've got a script to shake the browser window which works fine on an 'onLoad' event handler. I wondered if there is a way to call the shake function if the user either resizes the window or moves the whole browser window to a different location?
If so could you show me how to implement the code into the html?
Many thanks
Ryan
:confused:
A1ien51
03-10-2005, 08:37 AM
onresize="YourAnnoyingScriptThatWillMakeUsersLeave()"
onmove="YourAnnoyingScriptThatWillMakeUsersLeave()"
Eric
boobourne
03-10-2005, 10:16 AM
Thanks for the reply but I still can't get it to work - can you check through my code and let me know where I'm going wrong?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
netscape = (navigator.appName == "Netscape");
n4 = netscape && (parseInt(navigator.appVersion) >= 4);
explorer = (navigator.appName == "Microsoft Internet Explorer");
ie4 = explorer && (parseInt(navigator.appVersion) >= 4);
function shake(n) {
if (n4 || ie4) {
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);
}
}
}
}
// End -->
</script>
</head>
<script>onMove="shake(02);"</script>
<BODY>
<div align="center"><img src="jellyWeb01.jpg" width="780" height="832" /></div>
</body>
</html>
Cheers
Ryan