zoukankan      html  css  js  c++  java
  • e.srcElement和e.target使用例子

    转载网址:http://bbs.csdn.net/topics/370039876


    <html>

    <head>
    <title></title>

    <script src="js/jquery.js"></script>
    <script src="js/jquery.dimensions.js"></script>
    <script src="js/ui/ui.mouse.js"></script>
    <script src="js/ui/ui.draggable.js"></script>
    <script src="js/ui/ui.draggable.ext.js"></script>
    <script src="js/ui/ui.droppable.js"></script>
    <script src="js/ui/ui.droppable.ext.js"></script>
    <script src="js/ui/ui.sortable.js"></script>
    </head>

    <style>
    .title {
    font-weight:bold;
    font-size:12px;
    height:17px;
    padding:5px 5px 0px 25px;
    background:url(../images/titlebg.gif);

    border-bottom:1px solid #abc1dd;
    float:left;
    }

    .item {
     font-weight:bold;
     font-size:12px;
     height:17px;
     300px;
     border-bottom:1px solid #abc1dd;
     float:left;
    }

    .receive {
      height: 200px;
      300px;
     overflow-x: hidden;
     overflow-y: auto;
     float:left;
     
    }

    .navitem {
     font-weight:bold;
     font-size:12px;
     height:17px;
     300px;
     border-bottom:1px solid #abc1dd;
     float:left;
    }
    </style>

    <body>
     <div style="height:600px; 100%;">
            <div class="receive">
           <div class="navitem" id="onboard">登机人员</div>
          </div>
                       
            <div style="overflow-y:auto; overflow-x:hidden; 300px; height:100px;">
                  <div class="item" id="1">aaa</div>
                        <div class="item" id="2">bbb</div>
                        <div class="item" id="3">ddd</div>
                        <div class="item" id="4">eee</div>
                        <div class="item" id="5">fff</div>
                        <div class="item" id="6">ggg</div>
                        <div class="item" id="7">hhh</div>
                        <div class="item" id="8">iii</div>
                        <div class="item" id="9">jjj</div>
                        <div class="item" id="10">kkk</div>
                        <div class="item" id="11">lll</div>
                        <div class="item" id="12">mmm</div>
                        <div class="item" id="13">nnn</div>
                        <div class="item" id="14">ooo</div>
                        <div class="item" id="15">ppp</div>
                        <div class="item" id="16">qqq</div>
                        <div class="item" id="17">rrr</div>
                        <div class="item" id="18">sss</div>
                </div> 
      </div>
       
       
    </body>
    </html>

    <script language="javascript">
      var elem = '';
      $(document).ready(function(){
       
        $(".item").draggable({
     helper: 'clone',
     opacity: 0.55,
     start:function(e, ui)
        {
            elem = e.srcElement || e.target;
        }
        });
      });
     
      $(".receive").droppable({
     accept: ".item",
     activeClass: 'droppable-active',
     hoverClass: 'droppable-hover',
     drop: function(ev, ui)
        {
            var o = elem.innerHTML;
      var oid = o;
      var sid = "s" + oid;      
           
      //有相同的就不插入了。
      if ( document.getElementById(sid) == null)
      {
                $(this).append( "<div id='" + sid + "' title='"+ o +"' class='navitem'>" +  o + "<a href='#' onclick='javascript:$(this.parentNode).remove();' title='删除此栏'> X</a></div>" );
       
         }else  {
      
      
      alert ("您已经添加了这个栏目,请您删除后再添加,谢谢!")

      }
     }
     
    });
     

    </script>

  • 相关阅读:
    家庭记账本app进度之对于登录和注册两个界面点击按钮的相互跳转
    家庭记账本app进度之复选框以及相应滚动条的应用
    家庭版记账本app之常用控件的使用方法
    android 软件(app)之家庭版记账本首次进行helloword等相关测试
    家庭记账本app进度之android中AlertDialog的相关应用以及对日期时间的相关操作(应用alertdialog使用的谈话框)
    家庭版记账本app进度之关于android界面布局的相关学习
    家庭记账本app进度之关于单选按钮的相关操作(添加点击按钮事件以及点击单选更改事件)
    家庭记账本app进度之ui相关概念控制ui界面与布局管理
    家庭版记账本app进度之对于按钮的点击事件以及线性布局以及(alertdialog)等相关内容的应用测试
    乱了
  • 原文地址:https://www.cnblogs.com/lraa/p/2980300.html
Copyright © 2011-2022 走看看