| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 | <title>Menu iframe test</title> |
| 6 | <style type="text/css"> |
| 7 | @import "../themes/claro/claro.css"; |
| 8 | </style> |
| 9 | <script type="text/javascript" src="../../dojo/dojo.js" |
| 10 | data-dojo-config="parseOnLoad:true, isDebug:true"></script> |
| 11 | <script type="text/javascript"> |
| 12 | dojo.require("dojo.parser"); |
| 13 | |
| 14 | dojo.require("dijit.Menu"); |
| 15 | dojo.require("dijit.MenuItem"); |
| 16 | |
| 17 | function setContents(str){ |
| 18 | dojo.byId('iframe').src = "javascript:'" + str.replace("'", "\\'") + "'"; |
| 19 | } |
| 20 | function button2(){ |
| 21 | setContents('<div style="height: 300px; border: solid blue 2px">bill was here</div>'); |
| 22 | } |
| 23 | </script> |
| 24 | </head> |
| 25 | <body class="claro" role="main"> |
| 26 | <div id="menu" data-dojo-type="dijit/Menu" data-dojo-props='targetNodeIds:["iframe"], style:"display:none;"'> |
| 27 | <div data-dojo-type="dijit/MenuItem">context menu</div> |
| 28 | </div> |
| 29 | <div style="border: 1px solid gray; height: 150px;">filler div to offset iframe position (for testing)</div> |
| 30 | <div style="position: relative; border: 3px solid blue; padding: 10px;"> |
| 31 | This is a position:relative div containing an iframe. |
| 32 | <iframe title="iframe" id="iframe" |
| 33 | src="javascript:'<html><body style=\'margin: 3em;\'><div style=\'height:300px;border:1px solid red;\'>right click for menu</div><body></html>'" |
| 34 | style="height: 200px; margin: 30px; padding: 20px; border: solid dotted 10px;" onload="console.log('iframe onload');"> |
| 35 | </iframe> |
| 36 | End of div. |
| 37 | </div> |
| 38 | <br> |
| 39 | <button id="resetToDoc" onclick="dojo.byId('iframe').src='layout/doc0.html'">reset contents to doc0.html</button> |
| 40 | <button id="resetToBill" onclick="button2();">reset contents to 'bill was here'</button> |
| 41 | <button id="detachMenu" onclick="dijit.byId('menu').unBindDomNode('iframe')">detach menu</button> |
| 42 | <button id="reattachMenu" onclick="dijit.byId('menu').bindDomNode('iframe')">re-attach menu</button> |
| 43 | </body> |
| 44 | </html> |