JavaScript 鼠标拖拽进行快速产品分类效果
代码示例
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<mce:style><!--
.man{ float:left; background:#9af; margin:3px; padding:3px; cursor:default}
--></mce:style><style mce_bogus="1">.man{ float:left; background:#9af; margin:3px; padding:3px; cursor:default}</style>
<body>
<div>
未分类
<div style="width:500px; height:30px; border:#69f solid 1px; margin:3px"><input>
<div onmousedown=mdv() class="man">aaa</div>
<div onmousedown=mdv() class="man">bbb</div>
<div onmousedown=mdv() class="man">ccc</div>
</div>
分类1:<div style="width:500px; height:20px; border:#69f solid 1px; margin:3px" ><input></div>
分类2:<div style="width:500px; height:20px; border:#69f solid 1px; margin:3px" ><input></div>
分类3:<div style="width:500px; height:20px; border:#69f solid 1px; margin:3px" ><input></div>
分类4:<div style="width:500px; height:20px; border:#69f solid 1px; margin:3px" ><input></div>
</div>
<div style="width:500px; height:20px; border:#69f solid 1px; margin:3px" ></div>
<input id=tt><a href="">123</a>
<mce:script type="text/javascript"><!--
function getOffset(obj,isLeftOffset)
{
var offsetValue=0;
while(obj!=null)
{
offsetValue+=obj["offset"+(isLeftOffset?"Left":"Top")];
obj=obj.offsetParent
}
return offsetValue
}
function mdv()
{
obj=event.srcElement
obj.style.position="absolute"
if(event.button==2 ||event.button==0) return;
obj.p=obj.parentNode.parentNode.childNodes
obj.nowp=obj.parentNode
obj.nowp.style.background='#faa'
obj.DS_x=25;
obj.DS_y=15;
obj.setCapture();
obj.moving=true;
obj.onmousemove=function()
{
if(event.button==1&obj.moving)
{
var X=obj.style.pix
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
推荐兼容 IE、 FireFox 的 javascript 日历控件
原创作者:寒羽枫(cityhunter172)
一、简介与声明
此日历控件是 CSDN 网友 KimSoft 的作品:http://blog.csdn.net/kimsoft/archive/2006/05/24/753225.aspx 。界面清爽,纯 ......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<mce:style type="text/css"><!--
div#show { float: right; color: blue; }
--></mce:style><style type="text/css" mce_bogus=" ......
通常用typeof来判断js变量的类型,但很多时候仅仅typeof满足不了要求的。
我写了一个自定义函数来做这个事,判断的比较全面了。
New
function
varType(v){
if
(
typeof
v===
"object"
){
if
(v===
null
)
return
'null'
;
if
(v.
constructo ......
看了很多javascrip代码,发现很多地方用到了this这个对象,那这个到底是什么东西阿?
先让我们来理解一个概念:
在javascript会有一个上下文的概念,任何一个对象无论是Object 还是function 都会有一个专有的上下文对象,也可以理解为它自己的拥有者。
那么我们很容易想到这个拥有者,必然有个终点,那就是window对象。
......