很久很久以前用javascript写的一个可以按住鼠标左键不动,然后写字的效果,记得一开始发布到网上的时候可受欢迎了,呵呵,今天再次从笔记本里翻出来分享给大家,希望大家不要吝啬,多转载,但是转载请著名出处,以下是源码,您可以复制之后保存演示效果,如果觉得这个写字效果不错,自己可以考虑改善下
<!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=gb2312 />
<title>可擦写的程序</title>
<style type=text/css>
* {
-moz-user-select:none;
border:0px;
}
#tips {
width:850px;
padding-top:8px;
padding-bottom:8px;
background:#999999;
color:#ffffff;
text-align:center;
margin:auto;
font-size:14px;
}
</style>
<script type=text/javascript>
var is_mouse_down = false
var is_first=1
function create(evt){
evt=evt?evt:window.event
if(is_mouse_down){
if(evt.ctrlkey) clean(evt)
else write(evt)
}
}
function write(evt){
evt=evt?evt:window.event
var obj_nian=document.createelement(div)
obj_nian.style.position=absolute
obj_nian.style.left=evt.clientx-10+px
obj_nian.style.top=evt.clienty-10+px
switch(is_first){
case 1:obj_nian.innerhtml=淘;break;
case 2:obj_nian.innerhtml=宝;break;
case 3:obj_nian.innerhtml=是;break;
case 4:obj_nian.innerhtml=坏;break;
case 5:obj_nian.innerhtml=蛋;break;
case 6:obj_nian.innerhtml=。;break;
default:obj_nian.innerhtml=error;break;
}
is_first+=1
if(is_first==7) is_first=1
color_nian=rgb(+math.floor(math.random()*100)+%,+math.floor(math.random()*100)+%,+math.floor(math.random()*100)+%)
obj_nian.style.color=color_nian
document.body.appendchild(obj_nian)
}
function clean(evt){
evt=evt?evt:window.event
evt.srcobj=evt.srcelement?evt.srcelement:evt.target
if(evt.srcobj.tagname==div && (evt.srcobj.innerhtml==淘 || evt.srcobj.innerhtml==宝 || evt.srcobj.innerhtml==是 || evt.srcobj.innerhtml==坏 || evt.srcobj.innerhtml==蛋 || evt.srcobj.innerhtml==。)) evt.srcobj.innerhtml=
}
document.onmousedown=function(){is_mouse_down=true}
document.onmousemove=create
document.onmouseup=function(){is_mouse_down=false}
</script>
</head>
<body onselectstart=javascript:return false>
<div id=tips>提示:按住鼠标左键不放,在页面中拖动即可写字 ; 同时按住ctrl和鼠标左键不放,在页面中拖动即可把字擦去</div>
</body>
</html>
在网站建设开发中PDF文档运用最佳实践探索为什么要学SEO优化运用技巧设计网页的图片原则都有哪些?谁真的使用新的域名扩展?不得不知搜索引擎优化中网站建设页脚设计!seo导航如何合理地设置导航栏目?什么结构的网站利于SEO优化?企业网站建设都有哪些功能