•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 456,588 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,574 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1142 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Below is the code
var dragapproved=false
var z,x,y
function move()
{
if ((event.button==1||event.button==0)&&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
}
}
function swap(){
q=event.srcElement
z=q
dragapproved=false
}
document.onmousedown=drags
document.onmouseup=swap
var dragapproved=false
var z,x,y
function move()
{
if ((event.button==1||event.button==0)&&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
}
}
function swap(){
q=event.srcElement
z=q
dragapproved=false
}
document.onmousedown=drags
document.onmouseup=swap
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Can't drag and drop (OS X)
- random selection with drag and drop label function( help needed!! ) (Visual Basic 4 / 5 / 6)
- Drag and Drop (JavaScript / DHTML / AJAX)
- Drag and drop an image (Java)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: JavaScript Issues
- Next Thread: Prototype.js


Linear Mode