Y
yawnmoth
http://www.frostjedi.com/terra/scripts/demo/onmouseup.html
In Firefox, if I click in the black box and then release, I get a
popup. If I click, drag the cursor, and then release, I don't.
Similarly, if I click and then release outside of the black box, I
don't get a popup, and I don't understand why.
If I comment out "document.getElemenById("demo").onmousedown =
mousedown;", it works. Why would that make a difference?
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>onmousedown / onmouseup</title>
</head>
<body id="body">
<div style="background: black; width: 50px; height: 50px" id="demo"></
div>
<script type="text/javascript">
document.body.onmouseup = mouseup;
document.getElemenById("demo").onmousedown = mousedown;
function mouseup() {
alert("test");
}
function mousedown() {}
</script>
</body>
</html>
In Firefox, if I click in the black box and then release, I get a
popup. If I click, drag the cursor, and then release, I don't.
Similarly, if I click and then release outside of the black box, I
don't get a popup, and I don't understand why.
If I comment out "document.getElemenById("demo").onmousedown =
mousedown;", it works. Why would that make a difference?
Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>onmousedown / onmouseup</title>
</head>
<body id="body">
<div style="background: black; width: 50px; height: 50px" id="demo"></
div>
<script type="text/javascript">
document.body.onmouseup = mouseup;
document.getElemenById("demo").onmousedown = mousedown;
function mouseup() {
alert("test");
}
function mousedown() {}
</script>
</body>
</html>