1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:composite="http://java.sun.com/jsf/composite"> <composite:interface> <composite:attribute name="ondragstart"/> </composite:interface> <composite:implementation> <div draggable="true" ondragstart="#{cc.attrs.ondragstart}"> <composite:insertChildren /> </div> </composite:implementation> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:util="http://java.sun.com/jsf/composite/util" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:h5="http://java.sun.com/jsf/composite/html5"> <script> function drop(event) { alert(event.dataTransfer.getData("text")); } </script> <h5:drop id="dropzone" ondrop="drop(event)"> <div class="welcomeImage"> <h:graphicImage id="welcomeImage" library="images" name="cloudy.gif"/> </div> </h5:drop> </ui:composition> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:composite="http://java.sun.com/jsf/composite"> <composite:interface> <composite:attribute name="ondragenter"/> <composite:attribute name="ondragover"/> <composite:attribute name="ondragleave"/> <composite:attribute name="ondrop"/> </composite:interface> <composite:implementation> <div id="#{cc.id}" ondragenter="#{cc.attrs.ondragenter}" ondrop="#{cc.attrs.ondrop}" ondragover="#{cc.attrs.ondragover}" ondragleave="#{cc.attrs.ondragleave}"> <composite:insertChildren /> </div> <script> html5.jsf.init("#{cc.id}"); </script> </composite:implementation> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | if (!html5) var html5 = {} if (!html5.jsf) { html5.jsf = { init : function(ccid) { var dropzone = $(ccid); dropzone.addEventListener("dragenter", function(event) { event.preventDefault(); }, false); dropzone.addEventListener("dragover", function(event) { event.preventDefault(); }, false); } }; } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |