javascript - Why 'onpaste' event does not work in Iframe with designmode="on"? -


in firefox, use , works properly,

event.observe(iframwin,"paste",tablealignmentfix); 

where iframwin=$("id").contentwindow;

and in ie,

event.observe(iframdoc,"paste",tablealignmentfix); 

where iframdoc =$("id").contentwindow.document;

in msie there no onpaste-event applied document, observe onpaste of document.body instead.

example should work in both browsers(also webkit ) :

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script> <script> function tablealignmentfix() {   alert("tablealignmentfix:you've pasted something"); }  function init(o) {    var doc=o.contentwindow.document;   if(doc.getelementsbytagname('body').length)   {     event.observe(doc.body,"paste",tablealignmentfix);     doc.designmode='on';   }   }  </script> <iframe onload="init(this);" src="about:blank" width="200" height"200"></iframe> 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -