anybody semi decent on making webpages?? Im doing a new project at school, and need to find the code or script to make something move when you point the mouse at it, so it 'dodges' the cursor preventing you from actually clicking on it.
Thanks
Thread: webpage help
Results 1 to 10 of 10
-
02-16-2009 06:06 PMP-4077 "The Swamp" S.B.Y.C. and Michigan medboat mothership
-
02-16-2009 06:19 PM
What do you mean Phragle.. Pretty much a roll over button
Some days your the fist and some days your the face!
-
02-16-2009 06:22 PM
RPM, I will send you a pm after class tonite. thanks.
P-4077 "The Swamp" S.B.Y.C. and Michigan medboat mothership
-
02-16-2009 06:27 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en-US">
<head><title>Click the Button</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript"><!--
function moveObj(obj){
var w = 600, h = 400;
newWidth = Math.floor(Math.random()*w);
newHeight = Math.floor(Math.random()*h);
obj.style.position="absolute";
obj.style.left=newWidth+"px";
obj.style.top=newHeight+"px";
}
function checkObj(event,obj){
var top = obj.style.top.split("px")[0];
var left = obj.style.left.split("px")[0];
if(top+5 > event.y || left+5 > event.x){moveObj(obj);}
}
window.setTimeout("checkObj(event,document.forms[0].elements[0]", 1);
document.onkeydown = function(){return false;}
//--></script>
</head>
<body onMouseMove="checkObj(event,document.forms[0].elements[0]);" onKeyPress="return false;">
<form action="" name="frm"><div>
<input type="button" value="Click Me Phragle!" onMouseOver="moveObj(this);" onClick="alert('Good Job');">
</div></form>
</body></html>
Test it here: http://jmarshall.com/easy/html/testbed.html
-
02-16-2009 11:21 PM
ok, I have the code adjusted so the speed and movement is fluid and can be ajusted for the frame size (damn, it's been 10+ years since I have messed with code) can I change the input type to .gif the value= filename as long as it's in the same directory?? that tested ok with a bogus file name displaying a red X so I believe it will work???? thanks for the code..I searched for almost 2 hours trying to find it this afternoon.
P-4077 "The Swamp" S.B.Y.C. and Michigan medboat mothership
-
02-17-2009 09:47 AM
Good work Mark.
-
02-17-2009 07:31 PM
You want the button to be the picture and when they onMouseOver it moves?
That was kind of random- if it is a picture you may want to slow it down where it just bounces around to another spot vs shooting all over the place
-
02-17-2009 08:04 PM
it's actually going to be a word, most likely in the form of a transparent .gif
itt's a scool project like I said, so it's going to have a button of the side frame that says "find the truth" then opens up frame with work that says click on "truth" to learn more with a decent sized colotfull "truth" under that..so they go to click on it, but the truth avoids them by moving about the page.P-4077 "The Swamp" S.B.Y.C. and Michigan medboat mothership
-
02-17-2009 08:06 PM
Post Ho thread sounds like you got it done?
-
02-17-2009 11:05 PM
Im getting close, still havent been able to test, won't start real construction untll this weekend. just trying to get the tools I will need.
P-4077 "The Swamp" S.B.Y.C. and Michigan medboat mothership