Jump to content

[SOLVED] attaching event handlers.


bennyboywonder

Recommended Posts

*edit* ok, this is a small part of a script from a tutorial, and when I move document.onMouseDown=startDrag; document.onMouseUp=stopDrag; outside of the window.onload handler (wasn't sure why he did that anyway) then it works. HOWEVER this only works when I include it in the main HTML document. If the script is imported via a js file, it doesn't work *edit*

 

trying to do a drag and drop script for my website. Halted at the very outset.

 

this just WILL NOT WORK.

 

help me here

function startDrag(e)
{
    alert("dragging started");
}
function stopDrag(e)
{
    alert("dragging stopped");
}
window.onload = function()
{
document.onMouseDown=startDrag;
document.onMouseUp=stopDrag;
}

Link to comment
https://forums.phpfreaks.com/topic/41118-solved-attaching-event-handlers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.