惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
Forbes - Security
Forbes - Security
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
V
Visual Studio Blog
月光博客
月光博客
博客园 - Franky
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Apple Machine Learning Research
Apple Machine Learning Research
The Register - Security
The Register - Security
S
SegmentFault 最新的问题
博客园 - 司徒正美
P
Proofpoint News Feed
Know Your Adversary
Know Your Adversary
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
A
Arctic Wolf
Cyberwarzone
Cyberwarzone
Simon Willison's Weblog
Simon Willison's Weblog
U
Unit 42
P
Proofpoint News Feed
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
T
Tenable Blog
Hugging Face - Blog
Hugging Face - Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
P
Palo Alto Networks Blog
V
V2EX
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tailwind CSS Blog
V
Vulnerabilities – Threatpost
Latest news
Latest news
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
Intezer
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
博客园 - 【当耐特】
B
Blog RSS Feed
N
Netflix TechBlog - Medium
Recent Announcements
Recent Announcements
NISL@THU
NISL@THU
C
Cisco Blogs
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security

博客园 - 探路者

编辑用户资料的时候,让用户的密码以星花显示 模仿层遮盖网页浏览区 gridview列 数字、货币和日期 显示格式 摘录小代码合集[1] 注册时阅读条款倒计时控制 通用JS倒计时代码 去除网页FLASH"单击并激活此控件"解决办法 Js实现Checkbox的全选/反选 实用天气代码 银行软键盘代码 改善用户体验之密码强度提示 div制作三角图标 IE滚动条样式 【WEB控件】[GridView系列]Panel+GridView 【Web控件】[GridView系列]给GridView添加滚动条 常用CSS样式 【HTML控件】[TextBox系列]搜索输入关键字 可以移动的漂浮层 Div滚动条样式 - 探路者
Blog常用拖动模块
探路者 · 2007-10-25 · via 博客园 - 探路者

============================================================================
前台页面代码 [提示:只需把信息替换成你要绑定的数据即可,代码里网络图片是测试加载用]
============================================================================

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>拖动模块</title>
    <style>  
  .dragTable  
  {  
  background-color:#DBE5CF;  
  position:relative;  
  }
  .dragTableHeader  
  {  
  cursor:move;
  }      
body,td,th {
 font-size: 12px;
}
a:link {
 text-decoration: underline;
}
a:visited {
 text-decoration: underline;
}
a:hover {
 text-decoration: none;
}
a:active {
 text-decoration: underline;
}
</style>
   

    <script type="text/javascript">
        window.onload=function(){
          var a = document.getElementById("loading");
          a.parentNode.removeChild(a);
        }
        document.write('<div id="loading" style="background:#CC4444;color:#FFF;width:80px;padding-left:5px;position:absolute;line-height:22px;font-size:12px">正在读取...</div>');
    </script>

    <script language="javascript" type="text/javascript" src="go.js"></script>

    <script defer>  
   document.onmousemove=MouseMoveToMove;  
   document.onmouseup=MouseUpToMove;    
    </script>

</head>
<body>
    <br />
    <form id="Form1" runat="server">
        <div align="center">
            <input type="button" id="save" value="保存修改" style="visibility: hidden; width: 80%;
                height: 30px; border-color: #AFD781; background-color: #ffffff; border-style: double;
                border-width: 1px" onclick="saveFun()"></div>
        <br />
        <table width="80%" border="0" cellpadding="5" cellspacing="1" bgcolor="#AFD781" align="center">
            <tr>
                <td valign="top" style="width: 25%; background-color: #ffffff; height: 135px;">
                    <input type="hidden" name="tableName" value="空间-------1">
                    <table border="0" cellpadding="5" cellspacing="1" width="100%" class="dragTable"
                        onmouseover="MouseOverFun(this);">
                        <tr>
                            <input type="hidden" name="tableName" value="体育新闻">
                            <td bgcolor="#AFD781" class="dragTableHeader" onmousedown='MouseDownToMove(this)'>
                                体育新闻</td>
                        </tr>
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <u><font color="red">体育新闻信息 </font></u>
                            </td>
                        </tr>
                    </table>
                    <table border="0" cellpadding="5" cellspacing="1" width="100%" class="dragTable"
                        onmouseover="MouseOverFun(this);">
                        <tr>
                            <input type="hidden" name="tableName" value="焦点信息">
                            <td bgcolor="#AFD781" class="dragTableHeader" onmousedown='MouseDownToMove(this)'>
                                焦点信息</td>
                        </tr>
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <u><font color="red">焦点新闻信息 </font></u>
                            </td>
                        </tr>
                    </table>
                    <table width="100%" onmouseover="MouseOverFun(this);" style="position: relative;
                        background-color: White">
                        <tr>
                            <td>&nbsp;
                               
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="50%" valign="top" style="height: 135px; background-color: #ffffff">
                    <input type="hidden" name="tableName" value="空间-------2">
                    <table border="0" cellpadding="5" cellspacing="1" width="100%" class="dragTable"
                        onmouseover="MouseOverFun(this);">
                        <tr>
                            <input type="hidden" name="tableName" value="娱乐新闻">
                            <td bgcolor="#AFD781" class="dragTableHeader" onmousedown='MouseDownToMove(this)'>
                                娱乐新闻</td>
                        </tr>
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <u><font color="red">娱乐新闻信息 </font></u>
                            </td>
                        </tr>
                    </table>
                    <table border="0" cellpadding="5" cellspacing="1" width="100%" class="dragTable"
                        onmouseover="MouseOverFun(this);">
                        <tr>
                            <input type="hidden" name="tableName" value="国际新闻">
                            <td bgcolor="#AFD781" class="dragTableHeader" onmousedown='MouseDownToMove(this)'>
                                国际新闻</td>
                        </tr>
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <u><font color="red">国际新闻信息 </font></u>
                            </td>
                        </tr>
                    </table>
                    <table width="100%" onmouseover="MouseOverFun(this);" style="position: relative;
                        background-color: White">
                        <tr>
                            <td>&nbsp;
                               
                            </td>
                        </tr>
                    </table>
                </td>
                <td valign="top" style="width: 25%; background-color: #ffffff; height: 135px;">
                    <input type="hidden" name="tableName" value="空间-------3">
                    <table border="0" cellpadding="5" cellspacing="1" width="100%" class="dragTable"
                        onmouseover="MouseOverFun(this);">
                        <tr>
                            <input type="hidden" name="tableName" value="实事新闻">
                            <td bgcolor="#AFD781" class="dragTableHeader" onmousedown='MouseDownToMove(this)'>
                                实事新闻</td>
                        </tr>
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <u><font color="red">实事新闻信息</font></u>
                            </td>
                        </tr>
                    </table>
                    <table border="0" cellpadding="5" cellspacing="1" width="100%" class="dragTable"
                        onmouseover="MouseOverFun(this);">
                        <tr>
                            <input type="hidden" name="tableName" value="农民新闻">
                            <td bgcolor="#AFD781" class="dragTableHeader" onmousedown='MouseDownToMove(this)'>
                                农民新闻</td>
                        </tr>
                        <tr>
                            <td bgcolor="#FFFFFF">
                                <u><font color="red">农民新闻信息 </font></u>
                            </td>
                        </tr>
                    </table>
                    <table width="100%" onmouseover="MouseOverFun(this);" style="position: relative;
                        background-color: White">
                        <tr>
                            <td>&nbsp;
                               
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <br />
        <br />
        <div align="center">
            <img src="http://www.wallcoo.com/human/hongkong_wallpaper_1024/mxxx01/%5Bwallcoo_com%5D_hongkong_wallpaper_0164.jpg"
                style="border: 3px solid #AFD781;" width="80%" /></div>
        <br />
    </form>
</body>
</html>

<script>  
  function  saveFun()  
  {  
   var   tableNameObjs=document.getElementsByName("tableName");  
   var   tempStr="";  
   for(var   i=0;i<tableNameObjs.length;i++)  
   {  
   tempStr +="\n"+tableNameObjs[i].value;  
   }  
   alert(tempStr);      
  }  
</script>

============================================================================
脚本go.js代码 [提示:复制保存成go.js文件,与页面放置一个文件夹下即可]
============================================================================

  var   beginMoving=false;  
  var   sourceObj=null;  
  var   dragTableHeader=null;  
  var   tipDiv=null;  
  var   allDragTables=new   Array();  
   
  function   MouseDownToMove(obj){  
  if((event.button&1)==0)   return;  
  sourceObj=obj.offsetParent;  
  sourceObj.style.zIndex=10;  
  sourceObj.mouseDownY=event.clientY;  
  sourceObj.mouseDownX=event.clientX;  
  beginMoving=true;
  dragTableHeader=obj;  
  dragTableHeader.setCapture();
  document.getElementById("save").style.visibility="visible";
  }  
  function   MouseMoveToMove(obj){  
  if(!beginMoving)   return;  
  sourceObj.style.top   =   (event.clientY-sourceObj.mouseDownY);  
  sourceObj.style.left   =   (event.clientX-sourceObj.mouseDownX);  
  setTipDivPosition();  
  }  
  function   MouseUpToMove(obj){  
  if(!beginMoving)   return;  
  dragTableHeader.releaseCapture();  
  sourceObj.style.top=0;  
  sourceObj.style.left=0;  
  sourceObj.style.zIndex=0;  
  beginMoving=false;  
  window.setTimeout("swapFun()",20);  
  }  
  function   MouseOverFun(obj){  
  if   (tipDiv==null)   {  
  tipDiv=document.createElement("<div style='border:1px solid blue'>");
  }  
  obj.insertAdjacentElement("beforeBegin",tipDiv);  
  if(obj==sourceObj)   return;  
  }  
  function   swapFun(){  
  if(sourceObj!=null)   tipDiv.insertAdjacentElement("afterEnd",sourceObj);  
  sourceObj=null;  
  }  
  function   setTipDivPosition(){  
  var   allTables=document.getElementsByTagName("table");  
  for(var   i=0;i<allTables.length;i++){  
  if(allTables[i]==sourceObj)   continue;  
  if(allTables[i].className=="dragTable"   &&   isMouseInBox(allTables[i])){  
  allTables[i].insertAdjacentElement("beforeBegin",tipDiv);  
  return;  
  }  
  }  
  sourceObj.insertAdjacentElement("beforeBegin",tipDiv);  
  }  
  function   isMouseInBox(obj){    
  var   point1=new   Array(event.clientX+document.body.scrollLeft,event.clientY+document.body.scrollTop);    
  var   point2=getObjPosition(obj);    
  return(   (point1[0]>=point2[0])   &&   point1[1]>=point2[1]   &&   point1[0]-point2[0]<=obj.offsetWidth   &&   point1[1]-point2[1]<=obj.offsetHeight   )  
  }    
  function   getObjPosition(obj){    
  var   point=new   Array(0,0);    
  while(obj!=document.body){  
  point[0]+=obj.offsetLeft;  
  point[1]+=obj.offsetTop;  
  obj=obj.offsetParent;  
  }  
  return   point;  
  }