繁体   English   中英

从可放置区域放置时如何获取图像的值?

[英]how to get the value of the image when drop from the droppable area?

我在这里从jquery拖放代码,我想获取图像的值,然后将其插入数据库,当从可放置区域中删除图像时,再更新并删除图像值..我该怎么办? 这是代码...

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>jQuery UI Droppable - Default functionality</title>
    <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
    <script src="js/jquery-1.4.4.js"></script>
    <script src="js/jquery.ui.core.js"></script>
    <script src="js/jquery.ui.widget.js"></script>
    <script src="js/jquery.ui.mouse.js"></script>
    <script src="js/jquery.ui.draggable.js"></script>
    <script src="js/jquery.ui.droppable.js"></script>
    <link rel="stylesheet" href="js/demos.css">
    <style>
    #comment { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
    #draggable1 { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
    #droppable { width: 500px; height: 200px; padding: 0.5em; float: left; margin: 10px; background: silver;}

    </style>
    <script>
    $(function() {
        $( "#comment" ).draggable();
        $( "#draggable1" ).draggable();
        $( "#droppable" ).droppable({

            drop: function( event, ui ) {
            $( this )
            .find( "p" )
                .html("Dropped!")
            },
            out: function(event, ui) {
            $(this)
            .find( "p" )
                .html("Drop Node Here!");   
            }
        });
    });


    </script>
</head>
<body>

<div class="demo">

<div id="comment" class="ui-widget-content">
    <img src="images/signup.png" id="1">
</div>
<div id="draggable1" class="ui-widget-content">
    <img src="images/signup.png" id="2">
</div>



<div id="droppable" class="ui-widget-header">
    <p>Drop Node here</p>
    <?php
        $comment = "#comment";
        $drop = "#droppable";
        $dropped = "dropped";
        require_once("includes/connection.php");

        require_once("includes/close.php");
    ?>
</div>

</div><!-- End demo -->

</body>
</html>

在我的头顶上,像这样的东西应该给你图像的源

drop: function( event, ui ) {
var image_src = $(ui).attr('src');

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM