iframe_example.html 948 B

12345678910111213141516171819202122232425262728293031323334
  1. <html>
  2. <body>
  3. <iframe id="reveal" src="reveal.js/index.html" width="500" height="500"></iframe>
  4. <div>
  5. <input id="back" type="button" value="go back"/>
  6. <input id="ahead" type="button" value="go ahead"/>
  7. <input id="slideto" type="button" value="slideto 2-2"/>
  8. </div>
  9. <script>
  10. (function (){
  11. var back = document.getElementById('back'),
  12. ahead = document.getElementById('ahead'),
  13. slideto = document.getElementById('slideto'),
  14. reveal = window.frames[0];
  15. back.addEventListener('click', function (){
  16. reveal.postMessage(JSON.stringify({method: 'prev', args: []}), '*');
  17. },false);
  18. ahead.addEventListener('click', function (){
  19. reveal.postMessage(JSON.stringify({method: 'next', args: []}), '*');
  20. },false);
  21. slideto.addEventListener('click', function (){
  22. reveal.postMessage(JSON.stringify({method: 'slide', args: [2,2]}), '*');
  23. },false);
  24. }());
  25. </script>
  26. </body>
  27. </html>