Hi
I am new in java script.I have a table I have a table with some images. I need to swap the images when I drag and drop.My drag and drop is working fine.I dontknow how to swap te images.

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.