易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript drag类

<!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=utf-8" />
<title>drag类</title>
</head>
<body>
<mce:style><!--
#pop{width:400px;background-color:#CCCCCC; border:1px solid #000;}
#popt{border:1px solid #000; border-left:none; border-right:none; cursor:move}
#btnclost{cursor:hand;float:right}
#popm{height:300px;}
#ddd{float:left}
--></mce:style><style mce_bogus="1">#pop{width:400px;background-color:#CCCCCC; border:1px solid #000;}
#popt{border:1px solid #000; border-left:none; border-right:none; cursor:move}
#btnclost{cursor:hand;float:right}
#popm{height:300px;}
#ddd{float:left}</style>
<div id="ddd" style="width:200px;height:200px;border:1px solid;background-color:#CCCCCC;cursor:move">
222222222222222222222222
</div>
<div id="pop" >
<span id="btnclost">X</span><div id="popt">标题标题标题标题标题标题</div>
<div id="popm">
内容内容内容内容内容内容内容内容内容内容内容内容
</div>
</div>
function $(o){return document.getElementById(o)}
//$('btnclost').onclick=function(){$('pop').style.display='none';}
var drag=function(obj,handle){
this.no=$(obj).cloneNode(true);
if($(obj)){
this.o=$(obj);
this.hd=(!$(handle)?this.o:$(handle));
this.hd.onmousedown=(function(e,no){
return function(e){
if(!e){var e=window.event}
x=$(obj).offsetLeft;
y=$(obj).offsetTop;
ow=e.clientX-x;
oh=e.clientY-y;
with(no.style){
position='absolute';
left=x+'px';
top=y+5+'px';
filter='Alpha(Opacity="30")';
}
document.body.appendChild(no);
document.onselectstart=function(){return false}
}
}
)(window.event,this.no)
this.no.onmouseup=function(e){

if(!e){var


相关文档:

javascript memo

1.javascriptでURLの"?"以降のパラメータを取得:
var query = window.location.search.substring(1);
var pairs = query.split("&");
2.IE浏览器默认的功能停止
   (Tab键在地址栏等中的移动停止)
 
function stopDefaultKey(){
        window.e ......

javascript验证文本框内容

验证文本框内容不能为空
<input onblur="if(this.value.replace(/^ +| +$/g,'')=='')alert('不能为空!')">
只能输入英文和数字
<input onblur="if(/[^0-9a-zA-Z]/g.test(value))alert('有错')">
<input onkeyup="value=value.replace(/[^0-9a-zA-Z]/g,'')"/>
<input type="text" onkeyup="value ......

javascript数组唯一化实现方式

实现方式
这里给出2中实现方式。一种是大家应该都知道的indexOf检测的方式,另一种是结合lastIndexOf和splice实现方式。
//首先给Array对象原型上添加indexOf和lastIndexOf方法.(如果没有的话)
if(!Array.prototype.indexOf){
Array.prototype.indexOf = function(element, index){
var length = this.len ......

Javascript中常用的几个技巧


1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)> <td>no </table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut=" ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号