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

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


相关文档:

javascript将字符串类型转换为XML对象

try { //Internet Explorer
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(data);
} catch(e) { //Other Browsers
parser=new DOMParser();
xmlDoc=parser.parsefromString(data,"text/xml");
} ......

JavaScript取得select option value

<!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=" ......

JavaScript动态调整图片尺寸

在自己的网站上更新文章时一个比较常见的问题是:文章插图太宽,使整个网页都变形了。如果对每个插图都先进行缩放再插入的话,太麻烦了。
我前段时间写的一篇文章就遇到过这种事情,后来用CSS的overflow和max-width属性暂时解决了页面变形的问题。这种方法好处是简单,但坏处是会破坏某些细节的效果。
如overflow:hidden ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号