zoukankan
html css js c++ java
Javascript, How to make a Dress Up Game (Drag and Drop)
<
style
>
<!--
.dragme
{position:relative;}
-->
</
style
>
<
script language
=
"
JavaScript1.2
"
>
<!--
var
ie
=
document.all;
var
nn6
=
document.getElementById
&&!
document.all;
var
isdrag
=
false
;
var
x,y;
var
dobj;
function
movemouse(e)
{
if
(isdrag)
{
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;
var
topelement
=
nn6
?
"
HTML
"
:
"
BODY
"
;
while
(fobj.tagName
!=
topelement
&&
fobj.className
!=
"
dragme
"
)
{
fobj
=
nn6
?
fobj.parentNode : fobj.parentElement;
}
if
(fobj.className
==
"
dragme
"
)
{
isdrag
=
true
;
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;
return
false
;
}
}
document.onmousedown
=
selectmouse;
document.onmouseup
=
new
Function(
"
isdrag=false
"
);
//
-->
</
script
>
<
img src
=
"
ttt.jpg
"
class
=
"
dragme
"
>
JSON(
http://www.json.org/json-zh.html
)
<
script
>
var
myJSONObject
=
{
"
bindings
"
:
[
{
"
ircEvent
"
:
"
PRIVMSG
"
,
"
method
"
:
"
newURI
"
,
"
regex
"
:
"
^http://.*
"
}
,
{
"
ircEvent
"
:
"
PRIVMSG
"
,
"
method
"
:
"
deleteURI
"
,
"
regex
"
:
"
^delete.*
"
}
,
{
"
ircEvent
"
:
"
PRIVMSG
"
,
"
method
"
:
"
randomURI
"
,
"
regex
"
:
"
^random.*
"
}
]
}
;
alert(myJSONObject.bindings[
0
].method);
//
"newURI"
</
script
>
查看全文
相关阅读:
. net core的发布
Using Redis Cache for session data storage in ASP.NET Core
WCF之双工服务
值得参考的.net core 的博客
一、获取EF
limit 基本实现方式
Session机制详解及分布式中Session共享解决方案
ASP.NET Core 中的基于角色的授权ASP.NET Core 中的基于角色的授权
WCF之双工服务
苹果公司的粉丝转抄
原文地址:https://www.cnblogs.com/snowball/p/562873.html
最新文章
移动像素的px ,dp/pt,dpr的关系
怎么计算手机的逻辑分辨率?
sublime text3 添加新片段
session和cookie的知识总结
织梦后台初体验
CSS像素、物理像素、逻辑像素、设备像素比、PPI、Viewport
dw cs6设置字体样式
clearfix清除浮动
sublime text3文本字体大小设置
PHP会话cookie类的封装
热门文章
.NET 中 async 和 await
UML类图
包含UAC的系统(如win7、win10等)开机自动启动应用程序
Asp.Net Core SwaggerUI 接入
529.扫雷游戏
通俗系列之同步、异步、阻塞和非阻塞
Asp.Net Core 使用 MediatR
一起学习设计模式设计模式
Vue中 async 和 await
C# 进程间的同步 EventWaitHandle
Copyright © 2011-2022 走看看