代码
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" />
< title > 无标题文档 </ title >
</ head >
< body >
< input type ="file" id ="browse" size ="1" style ="position: absolute; width: 10px; filter: alpha(opacity=0);
opacity: 0; top: 0px;" />
< img id ="imgBlog" src ="upload.gif" align ="absmiddle" />
< script >
function ss() {
var img = document.getElementById( " imgBlog " );
var file = document.getElementById( ' browse ' );
img.onmousemove = function (e) {
var x, y;
if (e) { x = e.clientX; y = e.clientY; }
else { x = event.x; y = event.y; }
window.status = x + " , " + y;
file.style.left = (x - 10 ) + ' px ' ;
file.style.top = (y - 10 ) + ' px ' ;
};
};
ss();
</ script >
</ body >
</ html >
< html xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" />
< title > 无标题文档 </ title >
</ head >
< body >
< input type ="file" id ="browse" size ="1" style ="position: absolute; width: 10px; filter: alpha(opacity=0);
opacity: 0; top: 0px;" />
< img id ="imgBlog" src ="upload.gif" align ="absmiddle" />
< script >
function ss() {
var img = document.getElementById( " imgBlog " );
var file = document.getElementById( ' browse ' );
img.onmousemove = function (e) {
var x, y;
if (e) { x = e.clientX; y = e.clientY; }
else { x = event.x; y = event.y; }
window.status = x + " , " + y;
file.style.left = (x - 10 ) + ' px ' ;
file.style.top = (y - 10 ) + ' px ' ;
};
};
ss();
</ script >
</ body >
</ html >