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>
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;" />
You have to change your code to:
<input type="button" value="texarea 1" onClick="nicEditors.findEditor('cnt').setContent(Math.random() * 100);" />
Check the API from nicEditors
: http://wiki.nicedit.com/w/page/521/Javascript%20API
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.