G
Gary Mayor
Hi,
I'm re phrasing and earlier question as the earlier question doesn't
make to much sense. I using document.onmousemove to move a <div line on
the screen. At the moment if I click and move the mouse over the image
it doesn't move the line but if I click off the image and move the mouse
the line moves like it's supposed to. Also if I click it off the image
and move the mouse over the image it then works. Something on clicking
the image is messing it up.
Can someone please tell me why when I click off the image it works and
when i click on the image and move it it doesn't. Here's my script so far.
Help please as this has really got me stuck at the moment. The code
works in NS6 and Mozilla.
Thanks
Anyone Know?
Gary
<HTML>
<HEAD>
</head>
<body bgcolor="FFFFFF">
<img name="main" border="1" src="iecadaptor.jpg">
<div id="top2" style="position:absolute; width:308px; height:1px;
z-index:1; left: 29px; top: 23px; overflow: visible; visibility: hidden;
background-color: black; layer-background-color: black; border: 1px none
#000000"></div>
<script language="javascript">
<!---
document.onmousemove = getXY;
document.onmousedown = mousedown;
document.onmouseup = mouseisup;
var netscape = (document.layers) ? 1:0;
var goodIE = (document.all) ? 1:0;
var netscape6 = (document.getElementById && !document.all) ? 1:0;
var height = 100;
var width = 100;
var left = 50;
var top = 60;
var visible = false;
var mouseX = 0;
var mouseY = 0;
var mousedn = false;
var hspc = 40;
var vspc = 9;
var name = 'secondtop';
var mousePageX;
var mousePageY;
document.getElementById("top2").style.visibility="visible";
function mousedown(e)
{
//document.writeln("hello");
//document.getElementById("top2").style.visibility="visible";
//mouseX = e.pageX;
//mouseY = e.pageY;
//mouseX = mouseX - 29;
//mouseY = mouseY - vspc;
//document.getElementById("top2").style.width=mouseX;
mousedn = true;
//alert("hjiowewef");
//var thing;
}
// MOUSE MOVE DRAGGING LINE BUT LINE STOPS ON THE IMAGE WORKS OFF THE
IMAGE THOUGH
function getXY(e)
{
if(mousedn) {
width = width - 1;
mouseX = e.pageX;
mouseY = e.pageY;
mouseX = mouseX - 29;
mouseY = mouseY - vspc;
document.getElementById("top2").style.width=mouseX;
//alert("Mouse Move");
window.status = "X: " + mouseX + " Y: " + mouseY;
}
}
function mouseisup(e)
{
mousedn = false;
//alert("Mouse UP");
}
// -->
</script>
</body>
</html>
I'm re phrasing and earlier question as the earlier question doesn't
make to much sense. I using document.onmousemove to move a <div line on
the screen. At the moment if I click and move the mouse over the image
it doesn't move the line but if I click off the image and move the mouse
the line moves like it's supposed to. Also if I click it off the image
and move the mouse over the image it then works. Something on clicking
the image is messing it up.
Can someone please tell me why when I click off the image it works and
when i click on the image and move it it doesn't. Here's my script so far.
Help please as this has really got me stuck at the moment. The code
works in NS6 and Mozilla.
Thanks
Anyone Know?
Gary
<HTML>
<HEAD>
</head>
<body bgcolor="FFFFFF">
<img name="main" border="1" src="iecadaptor.jpg">
<div id="top2" style="position:absolute; width:308px; height:1px;
z-index:1; left: 29px; top: 23px; overflow: visible; visibility: hidden;
background-color: black; layer-background-color: black; border: 1px none
#000000"></div>
<script language="javascript">
<!---
document.onmousemove = getXY;
document.onmousedown = mousedown;
document.onmouseup = mouseisup;
var netscape = (document.layers) ? 1:0;
var goodIE = (document.all) ? 1:0;
var netscape6 = (document.getElementById && !document.all) ? 1:0;
var height = 100;
var width = 100;
var left = 50;
var top = 60;
var visible = false;
var mouseX = 0;
var mouseY = 0;
var mousedn = false;
var hspc = 40;
var vspc = 9;
var name = 'secondtop';
var mousePageX;
var mousePageY;
document.getElementById("top2").style.visibility="visible";
function mousedown(e)
{
//document.writeln("hello");
//document.getElementById("top2").style.visibility="visible";
//mouseX = e.pageX;
//mouseY = e.pageY;
//mouseX = mouseX - 29;
//mouseY = mouseY - vspc;
//document.getElementById("top2").style.width=mouseX;
mousedn = true;
//alert("hjiowewef");
//var thing;
}
// MOUSE MOVE DRAGGING LINE BUT LINE STOPS ON THE IMAGE WORKS OFF THE
IMAGE THOUGH
function getXY(e)
{
if(mousedn) {
width = width - 1;
mouseX = e.pageX;
mouseY = e.pageY;
mouseX = mouseX - 29;
mouseY = mouseY - vspc;
document.getElementById("top2").style.width=mouseX;
//alert("Mouse Move");
window.status = "X: " + mouseX + " Y: " + mouseY;
}
}
function mouseisup(e)
{
mousedn = false;
//alert("Mouse UP");
}
// -->
</script>
</body>
</html>