制作步驟:
一、准備圖片,取名替換webdesign.chinaitlab.com/dwsl/back.jpg,如下:
二、建一個htm文件取名drag.htm,並寫入下列代碼:
< HTML>
< head>
< title>可拖動的圖片< /title>
< meta http-equiv="Content-Type" content="text/html; charset=gb2312">
< /head>
< body bgcolor="#FFFFFF" text="#000000" scroll=no topmargin=0 leftmargin=0 onmousedown="x=event.x;y=event.y;setCapture()" onmouseup="releaseCapture()" onmousemove="if(event.button==1)top.moveTo(screenLeft+event.x-x,screenTop+event.y-y)" ondblclick="self.close()">
< img src="替換webdesign.chinaitlab.com/dwsl/back.jpg" width="120" height="120" style="cursor:hand;border:3 gold ridge">
< /body>
< /html>
drag.htm便是一個可以被拖動的頁面。
三、在其他頁面中調用drag.htm,加上下面的代碼:
< head>
< title>可全屏拖動的圖片< /title>
< meta http-equiv="Content-Type" content="text/html; charset=gb2312">
< script language="javascript">
function drag(){
var win;
win=window.open("drag.htm","","fullscreen");
win.moveTo(200,200);
win.resizeTo(126,126);
win.focus();
}
< /script>
< /head>
並用鏈接打開:
< a href="javascript:drag()">點擊這裡< /a>
好了,保存看看效果吧!