I have 2 files. a.html and b.html. a.html contains iframe with source b.html and 2 textareas (1 wysiwyg textarea and 1 standard textarea. b.html contain 2 buttons, button 1 to change textarea 1 value and button 2 to change textarea 2 value but button 1 not working. Please help a.html <script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script> <script type="text/javascript"> bkLib.onDomLoaded(function() { new nicEditor({fullPanel : true}).panelInstance('cnt'); }); </script> Iframe <iframe name="ifr" src="b.html" id="ifr" style="width:30%;display:block;"></iframe><br> <table> <tr> <td valign="top">Textarea 1 <textarea name="cnt" cols="30" rows="20" id="cnt"></textarea></td> <td valign="top"> Textarea 2<br> <textarea name="cnt2" cols="30" rows="20" id="cnt2"></textarea></td> </tr> </table> HTML: b.html <input type="button" value="texarea 1" onClick="parent.document.getElementById('cnt').value = Math.random() * 100;" /> <input type="button" value="texarea 2" onClick="parent.document.getElementById('cnt2').value = Math.random() * 100;" /> HTML:
dimes to dollars what's blocking you is the cross site scripting block. Frames are intentionally isolated from each-other and are NOT supposed to be allowed to have access to each-others content. The page in a iframe is NOT EVER supposed to be allowed to access the parent page's content, or vice-versa. It was used, abused, and eventually blocked. Whoever told you that you could do that isn't qualified to be telling you how to do things. Now that said - and apologies if this sounds harsh -- to be brutally frank what you've presented for code seems to me to indicate you don't know enough about HTML to be playing around with JavaScript yet. You're really NOT supposed to even be using iframes (as of like... 18 years ago), you've got tables for layout, no label tags, static scripting in the markup instead of having your scripts hook the markup, and likely zero graceful degradation for scripting off. You've got a laundry list of broken markup methodology mated to sloppy scripting practices. I'm not certain what it is you expect this mess to accomplish, but I'm pretty sure this isn't how you go about it. Lose the iframe nonsense and go learn some more HTML.
actualy this is just sample code, the original is too complicated but problem is the same change textarea on parent from hidden iframe. I just create my php ajax script.