Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling functoin within function from onmousemove

Status
Not open for further replies.

natesneat2000

Technical User
Jun 7, 2004
8
0
0
US
am selling a DVD of our graduation (b/c our school isn't selling tapes or anything), and am making an HTML menu with MenuBox for the DVD-ROM content. It'll basically be a pretty background with a bunch of layers, containing all the content, which can be dragged around.
I'm using this draggable layers script:
To support multiple layers, I replaced "dwindow" and the other calls with variables (like dwindow). My problem is, when initializeDrag calls drag_drop, drag_drop only gets contents of variable e, not dwindow. I'm not a master at JavaScript; please point me in the right direction.

<HEAD> Code Snippet

code:function drag_drop(e){
//alert(e)
//alert(dwindow)
//document.write(dwindow,e)
if (ie5&&dragapproved&&event.button==1){
document.getElementById(dwindow).style.left=tempx+event.clientX-offsetx+"px"
document.getElementById(dwindow).style.top=tempy+event.clientY-offsety+"px"
}
else if (ns6&&dragapproved){
document.getElementById(dwindow).style.left=tempx+e.clientX-offsetx+"px"
document.getElementById(dwindow).style.top=tempy+e.clientY-offsety+"px"
}
}

function initializedrag(e,dwindow,dwindowcontent){
offsetx=ie5? event.clientX : e.clientX
offsety=ie5? event.clientY : e.clientY
document.getElementById(dwindowcontent).style.display="none" //extra
tempx=parseInt(document.getElementById(dwindow).style.left)
tempy=parseInt(document.getElementById(dwindow).style.top)
dragapproved=true
document.getElementById(dwindow).onmousemove=drag_drop
 
Try changing this..
Code:
function drag_drop(e){
..to this:
Code:
function drag_drop(e[green],dwindow,dwindowcontent[/green]){
 
Afraid that doesn't work. I just can't get initializeDrag to pass dwindow to drag_drop. e passes fine.
 

As far as I know, when attaching events dynamically like that, you cannot pass any other parameters other than the event one itself.

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top