lilman Posted August 9, 2007 Share Posted August 9, 2007 I found this tutorial online, and although the code works perfectly, they didn't explain hardly anything. The most puzzling thing out of this code is that it doesn't use semicolons. Below is the code, if someone wouldn't mind, please explain why it is able to run without them. <head> <style> <!-- .drag{position:relative;cursor:hand} --> </style> <script language="JavaScript1.2"> <!-- /*Credit JavaScript Kit www.javascriptkit.com*/ var dragapproved=false var z,x,y function move() { if (event.button==1&&dragapproved){ z.style.pixelLeft=temp1+event.clientX-x z.style.pixelTop=temp2+event.clientY-y return false } } function drags() { if (!document.all) return if (event.srcElement.className=="drag"){ dragapproved=true z=event.srcElement temp1=z.style.pixelLeft temp2=z.style.pixelTop x=event.clientX y=event.clientY document.onmousemove=move } } document.onmousedown=drags document.onmouseup=new Function("dragapproved=false") //--> </script> </head> <body> <img src="http://www.google.com/intl/en_ALL/images/logo.gif" class="drag"><br> <img src="http://www.adobe.com/shockwave/download/images/flash_rune.gif" class="drag"><br> <b>"Hi there</b> </body> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.