Code: Select all
<a href="" id="pin" onmousedown="return pin_onmousedown(event)" onclick="return false" style="position:absolute;">
<img src="images/Pin.png" border="0" />
</a>Code: Select all
function pin_onmousedown(e)
{
if (document.getElementById("pin").style.left > 100)
{
document.getElementById("pin").style.left = 100;
}
else if (document.getElementById("pin").style.left < 40)
{
document.getElementById("pin").style.left = 40;
}
else
{
document.getElementById("pin").style.left = e.clientX - 6;
}
document.onmousemove = pin_onmousedown;
document.onmouseup = pin_onmouseup;
return false;
}
function pin_onmouseup()
{
document.onmousemove = new Function("return false");
}I don't know what I'm doing wrong the code isn't doing what I commanded it to. It seems to make perfect sense when you look at the code, it's just not stopping at 40 and 100.
Thanks for reading my post. I'd appreciate any help on this matter.