trying to do something easy in javascript >:o

Al Neri

Diamond Member
Jan 12, 2002
5,680
1
81
i want to have two text boxes and a button

when the button is pressed it invokes the shake function and shakes for whatevers in the text boxes

thanks in advance


<!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>
<html>
<head>

<SCRIPT LANGUAGE="JavaScript1.2">

function shake(n,z) {
if (self.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(z,0);
self.moveBy(-z,0);
}
}
}
}
</SCRIPT>
</head>
<body>
<input name="x" type="text" value="10" />
<input name="y" type="text" value="10" />

<input name="button" type="button" value="Shake" />

</body>
</html>
 

rh71

No Lifer
Aug 28, 2001
52,844
1,049
126
interesting... I've heard of shaking (moving rapidly) the whole browser window but never shaking an element inside a page.