012.xhtml (1491B)
1 <?xml version="1.0" encoding="utf-8"?> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>Drag and drop datastore: dragging element to object</title> 5 <style type="text/css"> 6 div 7 {height:100px; 8 width:100px; 9 padding:20px; 10 background-color:navy;} 11 object 12 {width:500px; 13 height:500px; 14 border:solid medium navy;} 15 </style> 16 <script type="application/ecmascript"> 17 <![CDATA[ 18 var dataTypes = ['text/plain', 'text/uri-list', 'application/xml', 'application/xhtml+xml', 'application/mathml+xml', 'image/svg+xml', 'text/html', 'text/x-example'], 19 data = ['PASS', 'data:text/plain,1', '<result>PASS</result>', '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Data store item</title></head><body><p>PASS</p></body></html>', '<math xmlns="http://www.w3.org/1998/Math/MathML"><mn>1</mn></math>', '<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100px" height="50px" viewBox="0 0 100 50"><text x="0" y="40" font-size="40" fill="green">PASS</text></svg>', '<!DOCTYPE html><html><head><title>Data store item</title></head><body><p>PASS</p></body></html>', 'PASS']; 20 function start(event) 21 {event.dataTransfer.effectAllowed = 'copy'; 22 for(var i = 0; i != dataTypes.length; i++) 23 {event.dataTransfer.setData(dataTypes[i], data[i]);} 24 } 25 ]]> 26 </script> 27 </head> 28 <body> 29 <div draggable="true" ondragstart="start(event)"/> 30 <p>Drag box above to the frame below.</p> 31 <object type="application/xhtml+xml" data="helper-drop-box-here.xhtml">XHTML document</object> 32 </body> 33 </html>