如何获取已删除图像的ID,此id将被发送到mysql

时间:2013-10-31 13:08:21

标签: php jquery mysql html5 drag-and-drop

我有问题。我创建了足球运动员和足球场的基地,他们将在那里投球。

屏幕截图>> http://www.dodaj.rs/f/3x/Jl/1Ee0tb6P/teren.jpg

的jQuery
我在youtube教程中找到了简单的拖放代码。

    function allowDrop(ev) {
    ev.preventDefault();
}

function drag(ev) {
    ev.dataTransfer.setData("img", ev.target.id);
}

function drop(ev) {

    var image = ev.dataTransfer.getData("img");
    ev.target.appendChild(document.getElementById(image));
    ev.preventDefault();
}

HTML
我在没有边框的情况下组织了职位,也许,HTML代码行为混乱。

<form action="" method="post">

            <div class="teren">
                <table>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="mid"></div></td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="def"></div></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>

                    <tr>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="for"></div></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="mid"></div></td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="def"></div></td>
                        <td>&nbsp;</td>
                    </tr>

                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="gk"></div></td>
                    </tr>

                    <tr>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="for"></div></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="mid"></div></td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="def"></div></td>
                        <td>&nbsp;</td>
                    </tr>

                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="mid"></div></td>
                        <td>&nbsp;</td>
                        <td><div id="box3" ondrop="drop(event)" ondragover="allowDrop(event)" class="def"></div></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
                <input type="submit" value="Pošalji" name="btnPosalji"/>

            </div>
</form>

0 个答案:

没有答案