Err Posted March 27, 2007 Share Posted March 27, 2007 Hello.I'm working on a VB.NET project in which I want to change the location of the form every time someone hovers over a button. For example, if I hover over an "Exit" button, I want the form to move to a different spot making it impossible to click it. I believe I've seen an example like this in JavaScript, but I can't recall where. Can someone please tell me how this is done or refer me to a good site at the very least? I could not find such a site, probably for obvious reasons. I would REALLY appreciate it.Thanks. Link to comment Share on other sites More sharing options...
jesh Posted March 27, 2007 Share Posted March 27, 2007 That's going to all be javascript and CSS. <html><head><style>#MyForm { position: absolute; top: 300px; left: 300px; }</style><script>function moveit(){ var form = document.getElementById("MyForm"); var _top = form.offsetTop; var _left = form.offsetLeft; form.style.top = (_top + Math.random()*100) + "px"; form.style.left = (_left + Math.random()*100) + "px";}</script><body><form id="MyForm"> <input type="submit" onmouseover="moveit();" value="Submit" /></form></body></html> Of course, this example only moves the form down and to the right. But you could introduce another variable (or two) that is randomly 1 or -1 to determine which direction to move the form.Hope this helps. Link to comment Share on other sites More sharing options...
Err Posted April 3, 2007 Author Share Posted April 3, 2007 Thanks for the reply man, however this wasn't was I was looking for. I wanted something for Visual Basic (VB), not JavaScript or any other web language. Sorry if I confused you. Link to comment Share on other sites More sharing options...
jesh Posted April 3, 2007 Share Posted April 3, 2007 Thanks for the reply man, however this wasn't was I was looking for. I wanted something for Visual Basic (VB), not JavaScript or any other web language. Sorry if I confused you. Ahh, I assumed you were building something for the web. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now