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

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
博客园_首页
雷峰网
雷峰网
V
Visual Studio Blog
爱范儿
爱范儿
A
About on SuperTechFans
量子位
N
Netflix TechBlog - Medium
Microsoft Security Blog
Microsoft Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
月光博客
月光博客
S
SegmentFault 最新的问题
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 燕闪硕

EF Core 批量操作实战:3 种方案对比与性能测试 Python 开发 Windows 客户端:Web 技术做界面的 5 款核心工具 Python描述器(Descriptor)深度解析:OOP底层核心机制实操指南 使用pyenv-win管理多版本Python Python字符串编码及正则表达式使用 利用canvas在手机页面实现景区导航的一点思路 重装系统后遇到Git Authentication failed 错误 [转帖]如何准确高效的获取数据库新插入数据的主键id [转帖]SQL中partition关键字的使用 利用分布类防止EF更新模型丢失验证信息 列表样式切换 CSS3 简易照片墙 HTML5表单增强 HTML 5 全局属性 微软build 2015 写个程序登陆58同城 工厂方法 简单工厂 System.Data.SQLite兼容32位和64位问题
HTML5 元素拖放
燕闪硕 · 2015-08-29 · via 博客园 - 燕闪硕
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>HTML5拖放</title>
        <script type="text/javascript">
            function allowDrop(ev)
            {
                ev.preventDefault();//取消默认
            }
            
            function drag(ev)
            {
                //设置被拖数据的数据类型和值
                //数据类型是 "Text",值是可拖动元素的 id ("drag1")。
                ev.dataTransfer.setData("Text",ev.target.id);
            }
            
            //进行放置
            function drop(ev)
            {
                ev.preventDefault();
                var data=ev.dataTransfer.getData("Text");
                ev.target.appendChild(document.getElementById(data));
            }
        </script>
    </head>
    <body>
        <h1>元素拖放</h1>
        <br /><br /><br /><br />
        <p id="text1" draggable="true" ondragstart="drag(event)" >可以被拖动</p>
        <div id="panel1" style="width: 100px; height: 100px; border: black solid 1px;float: left;margin-left: 100px;" ondrop="drop(event)" ondragover="allowDrop(event)">拖进来啊1</div>
        <div id="panel2" style="width: 100px; height: 100px; border: black solid 1px;float: left;margin-left: 200px;" ondrop="drop(event)" ondragover="allowDrop(event)">拖进来啊2</div>
    </body>
</html>

石家庄的.net程序员

posted @ 2015-08-29 16:13  燕闪硕  阅读(148)  评论()    收藏  举报