<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html >
< head >
< title > Untitled Page </ title >
< style >
.dragme{position:relative;}
</ style >
</ head >
< body >
< script language ="JavaScript" >
var ie= document .all;
var nn6= document .getElementById&&! document .all;
var x,y;
var dobj;
function movemouse(e)
{
if (dobj)
{
dobj.style.left = nn6 ? tx + e.clientX - x : tx + event .clientX - x;
dobj.style.top = nn6 ? ty + e.clientY - y : ty + event .clientY - y;
return false ;
}
}
function selectmouse(e)
{
var fobj = nn6 ? e.target : event .srcElement;
if (fobj.className== "dragme" )
{
dobj = fobj;
tx = parseInt(dobj.style.left+0);
ty = parseInt(dobj.style.top+0);
x = nn6 ? e.clientX : event .clientX;
y = nn6 ? e.clientY : event .clientY;
document .onmousemove=movemouse;
dbg( 'x:' , x, ' tx:' , tx);
return false ;
}
}
document .onmousedown=selectmouse;
document .onmouseup= new Function( "dobj=null" );
</ script >
< div id ="testDiv" style ="background-color:Purple;width:50px;height:50px" class ="dragme" >
</ div >
</ body >
</ html >
* This source code was highlighted with Source Code Highlighter .
dobj.style.left = nn6? tx + e.clientX - x: tx + event.clientX - x;
dobj.style.top = nn6? ty + e.clientY - y: ty + event.clientY - y;
<! DOCTYPE html PUBLIC "- // W3C // DTD XHTML 1.0 Transitional // EN" " www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Rather, the second. For the sake of market share, the developers of FF quietly made in their Quirks mode support for ancient non-standard non-standard features such as document.all, auto-add "px" for sizes and coordinates without specifying units in CSS and anything else. Due to this, the ancient curves of the page work under it without alteration. But if any normal doctype is specified, the browser reasonably expects the author to know what he was doing ... :)
they themselves wrote that FF should follow standards. So add px in dimension :)
Source: https://habr.com/ru/post/69950/
All Articles