Is there a way to check for scrollbars? What I need is a way to see if the user has written too much text in an iframe (using punyMCE). If the user has gone beyond the allowed number of lines (which will cause scrollbars to appear), I want to tell the user that the maximum number of lines has been entered.
Now there is a second problem. I can’t seem to get key-events to fire from inside the punyMCE frame. Which means there is no way for me to do the check… Any suggestions? I tried this:
frame = frames['eventTxt_f'].document.getElementsByTagName('body')[0]; frame.onkeydown = function() { alert('keydown'); }
A simpler way would probably be to compare the clientHeight of the contents of the iframe with the outer height of the iframe. Something like this:
(tested quickly with the PunyMCE Simple Example with FF3)