首页 新闻 论坛 群组 Blog 文档 下载 读书 Tag 网摘 搜索 .NET Java 游戏 视频 人才 外包 培训 数据库 书店 程序员
中国软件网
欢迎您:游客 | 登录 注册 帮助
  • 求DIV移动代码,以兼容FF, [已结贴,结贴人:janly]
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • janly
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    • 揭帖率:
    发表于:2008-05-24 06:17:30 楼主
    求DIV移动代码,以兼容FF,
    20  修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • rjzou2006
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-05-24 09:36:181楼 得分:0
    HTML code
    <!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> <title> New Document </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="zh-CN" /> <meta name="Design Corp" content="myhhe.cn" /> <meta name="Designer" content="hayden" /> <meta name="Designer mail" content="hayden@yeah.net" /> <meta name="robots" content="hayden" /> <meta name="Keywords" content="" /> <meta name="Description" content="" /> <script language="JavaScript" type="text/javascript"> var drag_=false var D=new Function('obj','return document.getElementById(obj);') var oevent=new Function('e','if (!e) e = window.event;return e') function Move_obj(obj){ var x,y; D(obj).onmousedown=function(e){ drag_=true; with(this){ style.position="absolute";var temp1=offsetLeft;var temp2=offsetTop; x=oevent(e).clientX;y=oevent(e).clientY; document.onmousemove=function(e){ if(!drag_)return false; with(this){ style.left=temp1+oevent(e).clientX-x+"px"; style.top=temp2+oevent(e).clientY-y+"px"; } } } document.onmouseup=new Function("drag_=false"); } } </script> <body> <div id="test" style="background-color:#0099CC;width:200px;height:100px;border:1px #000 solid;" onmouseover='Move_obj("test")'>鼠标过来点击拖动层</div> </body> </html>
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • kong521
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-05-24 23:20:292楼 得分:10
    <style type="text/css">
        #img1{
        border:1px green solid;
        position:absolute;
        left:2px;
        top:43px;
        width:147px;
        height:90px;
        z-index:100;
        visibility: visible;
        }

    </style>
    <div id="img1">
        <img src="http://gjp.kancai.com/images/gjp.bmp" alt="" /> </div>
    <script>
    var xPos = 300;
    var yPos = 200;
    var step = 1;
    var delay = 20;
    var height = 0;
    var Hoffset = 0;
    var Woffset = 0;
    var yon = 0;
    var xon = 0;
    var pause = true;
    var interval;
    img1.style.top = yPos;
    function changePos()
    {
    width = document.body.clientWidth;
    height = document.body.clientHeight;
    Hoffset = img1.offsetHeight;
    Woffset = img1.offsetWidth;
    img1.style.left = xPos + document.body.scrollLeft;
    img1.style.top = yPos + document.body.scrollTop;
    if (yon)
    {yPos = yPos + step;}
    else
    {yPos = yPos - step;}
    if (yPos < 0)
    {yon = 1;yPos = 0;}
    if (yPos >= (height - Hoffset))
    {yon = 0;yPos = (height - Hoffset);}
    if (xon)
    {xPos = xPos + step;}
    else
    {xPos = xPos - step;}
    if (xPos < 0)
    {xon = 1;xPos = 0;}
    if (xPos >= (width - Woffset))
    {xon = 0;xPos = (width - Woffset);  }
    }

    function start()
    {
    img1.visibility = "visible";
    interval = setInterval('changePos()', delay);
    }
    function pause_resume()
    {
    if(pause)
    {
    clearInterval(interval);
    pause = false;}
    else
    {
    interval = setInterval('changePos()',delay);
    pause = true;
    }
    }
    start();
    </script>
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • kong521
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-05-24 23:21:003楼 得分:0
    没用过FF
    你试试吧
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • btbtd
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-05-25 13:52:004楼 得分:10
    http://gi.2288.org/test/sqJsTools/tools/DragBox/DragBox2-1/Demo/General.html
    http://gi.2288.org/test/sqJsTools/tools/DragAndDrop/DragAndDrop1/Demo/General.html
    修改 删除 举报 引用 回复
    进入用户个人空间
    加为好友
    发送私信
    在线聊天
    • kingwolf_JavaScript
    • 等级:
    • 可用分等级:
    • 总技术专家分:
    • 总技术专家分排名:
    发表于:2008-06-07 23:48:095楼 得分:0
    不懂,学习。
    修改 删除 举报 引用 回复

    网站简介广告服务网站地图帮助联系方式诚聘英才English 问题报告
    北京创新乐知广告有限公司 版权所有 京 ICP 证 070598 号
    世纪乐知(北京)网络技术有限公司 提供技术支持
    Copyright © 2000-2008, CSDN.NET, All Rights Reserved