?? 15.27 可拖動的圖片.htm
字號:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>標題頁</title>
<style>
.drag{position:relative;cursor:hand}
</style>
<script language="JavaScript">
var dragapproved=false;
var z,x,y;
//移動圖片
function move()
{
if (event.button==1&&dragapproved){
z.style.pixelLeft=temp1+event.clientX-x;
z.style.pixelTop=temp2+event.clientY-y;
return false;
}}
function drags()
{
if (!document.all)
return;
if (event.srcElement.className=="drag"){
dragapproved=true;
//以下設置拖放時的位置
z=event.srcElement;
temp1=z.style.pixelLeft;
temp2=z.style.pixelTop ;
x=event.clientX;
y=event.clientY;
document.onmousemove=move; //綁定鼠標移動事件
}}
document.onmousedown=drags; //綁定鼠標單擊事件
document.onmouseup=new Function("dragapproved=false"); //鼠標up事件
</script>
</head>
<body>
<img src="LOGO1.gif" class="drag">
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -