Hi everybody,
Problem with dragging effect of resizing is working but having problem with setting a flag to determine if mouse button is click or not. Is there anyone knows how to fixed this? I used several ways to do this as shown below, all telling me the error below. I used IE 6 w/ SP1.
The error comes from onmousedown"mousedown()".
Error message:
Microsoft JScript runtime error: Object doesn't support this property or method
Approaches made:
[HTML]var mousedown = false;[/HTML]
inside mousedown,
[HTML]mousedown = true;[/HTML]
inside mousemove,
[HTML]if (mousedown)
{
....
}[/HTML]
Partial Codes:
[HTML]
<head>
<title>Untitled Page</title>
<script type="text/javascript" language="javascript">
var lLeft = 0;
var lTop = 0;
var mousedown;
function mouseDragImage(obj)
{
....
var dLeft, dTop;
var ev = window.event;
// if (window.event.button == 1)
// if (ev.button == 1)
// if (mousedown)
// if (mousedown == 'true')
if (mousedown == 1)
{
if(ev.pageX || ev.pageY){
newx = ev.pageX;
newy = ev.pageY;
}
else
{
newx = ev.clientX;
newy = ev.clientY;
}
.....
}
}
function mousedown()
{
// mousedown = 'true';
// mousedown = true;
if (mousedown != null || mousedown > 0)
{
mousedown = 1;
}
}
function mouseup()
{
// mousedown = 'false';
// mousedown = false;
mousedown = 0;
}
.....
</script>
</head>
<body>
<input id="Text1" type="text" /><br />
<img id="Img3" name="Img3" src="images/rock.jpg" onmouseover="mouseOver(this)" onmousedown="mousedown()" onmousemove="mouseDragImage(this)" onmouseout="mouseup()"/><br /><br />
<input id="Button1" type="button" value="button" />
</body>
[/HTML]
den2005