代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
JS
】
javascript 鼠标拖拉画图
作者:
CSDN
/ 发布于
2012/1/11
/
887
<div>javascript 鼠标拖拉画图 <span style="color: rgb(0,0,0)"><</span><span style="color: rgb(0,0,0)">script language</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">javascript</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)"> src</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">http://cm1212.com/FCKeditor/Tjquery.js</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)"> type</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">text/javascript</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">><</span><span style="color: rgb(0,0,0)">/</span><span style="color: rgb(0,0,0)">script></span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)"><</span><span style="color: rgb(0,0,0)">script language</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">javascript</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">></span><span style="color: rgb(0,0,0)"> onloadReady(</span><span style="color: rgb(0,0,255)">function</span><span style="color: rgb(0,0,0)"> (){ </span><span style="color: rgb(0,0,255)">var</span><span style="color: rgb(0,0,0)"> daw</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">false</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">var</span><span style="color: rgb(0,0,0)"> isi</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">false</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">var</span><span style="color: rgb(0,0,0)"> s</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">0</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">function</span><span style="color: rgb(0,0,0)"> down(e){ e</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">window.event </span><span style="color: rgb(0,0,0)">||</span><span style="color: rgb(0,0,0)"> e; s</span><span style="color: rgb(0,0,0)">+=</span><span style="color: rgb(0,0,0)">1</span><span style="color: rgb(0,0,0)">; daw</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">true</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">var</span><span style="color: rgb(0,0,0)"> divs</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">Tjquery.CreateElement(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">);</span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">本人的js库 创建节点</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> divs.id</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; divs.style.left</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">e.clientX</span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(0,0,0)">10</span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">px</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; divs.style.top</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">e.clientY</span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">px</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; divs.style.border</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">1px solid blue</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; divs.style.width</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">111px</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; divs.style.height</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">111px</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; divs.style.position</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">absolute</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; document.title</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">divs.style.left Tjquery.appendChild(divs);</span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">本人的js库 添加节点</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> Tjquery.setAlpha(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">,</span><span style="color: rgb(0,0,0)">50</span><span style="color: rgb(0,0,0)">);</span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">设置透明度 这里使用了本人的js库</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> } </span><span style="color: rgb(0,0,255)">function</span><span style="color: rgb(0,0,0)"> drawmove(e){ </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)">(daw</span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,255)">false</span><span style="color: rgb(0,0,0)">) </span><span style="color: rgb(0,0,255)">return</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">false</span><span style="color: rgb(0,0,0)">;</span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">防止重复</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> e</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">window.event </span><span style="color: rgb(0,0,0)">||</span><span style="color: rgb(0,0,0)"> e; Css(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).width</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">e.clientX</span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(0,0,0)">parseInt(Css(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).left)</span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">px</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; Css(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).height</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">e.clientY</span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(0,0,0)">parseInt(Css(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).top)</span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">px</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; Css(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).backgroundColor</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">#000333</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; } document.onmousedown</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">down; </span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">鼠标按下事件</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> document.onmousemove</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">drawmove; </span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">鼠标移动事件 </span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> document.onmouseup</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">function</span><span style="color: rgb(0,0,0)"> (e){ e</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">window.event </span><span style="color: rgb(0,0,0)">||</span><span style="color: rgb(0,0,0)"> e; daw</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">false</span><span style="color: rgb(0,0,0)">; isi</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,255)">true</span><span style="color: rgb(0,0,0)">; Css(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).backgroundColor</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">#ffffff</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">; getid(</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">).id</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">div</span><span style="color: rgb(0,0,0)">"</span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)">s; </span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)">重新定义id属性 以便重新绘制新图</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)"> document.title</span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)">s } }) </span><span style="color: rgb(0,0,0)"><</span><span style="color: rgb(0,0,0)">/</span><span style="color: rgb(0,0,0)">script></span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)"> </span></div>
试试其它关键字
鼠标拖拉画图
同语言下
.
Jquery搜索框获取回车事件
.
H5页面添加倒计时,然后自动跳转
.
通过user-agent判断h5页面是在哪个手机App(QQ、微信
.
nginx 禁止未绑定的域名访问
.
JavaScript 获取按键,并屏蔽系统 Window 事件
.
H5之只允许微信浏览器打开,禁止从外部浏览器访问
.
微信打开网址添加在浏览器中打开提示的办法
.
实现JS复制、粘贴,Chrome/Firefox下可用
.
video视频播放,play()、pause()、duration时长、onen
.
HTML5实现MP3上传前的预览和播放时长的获取
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
CSDN
贡献的其它代码
(
27
)
.
xml操作类
.
完全无组件,不用调用Excel.exe 导出数据到Excel
.
DropDownList手动构造一个下拉树形
.
判断是否低于IE6的版本
.
javascript 鼠标拖拉画图
.
取汉字首字母
.
字符串格式化通用类
.
mssql海量高效分页存储过程
.
.net 获取远程IP 得到省市
.
javascript 模仿windows拖动 封装类
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3