Have you tried printing the tags inside the iframe
Code:
var testing = document.getElementById("compose_editorArea");
var doc = testing.contentDocument;
var textareas = doc.getElementsByTagName("textarea");
alert(textareas.length);
Alternatively, maybe contentEditable="true" is being used on the body of the iframe so you can get the text by doing the following:
Code:
var testing = document.getElementById("compose_editorArea");
var doc = testing.contentDocument;
var text = doc.body.innerHTML
alert(text);
Playing around with the above e.g. might not be body and textarea should yield the answer.
var scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
scriptElement.innerHTML ='function checkForvalue() { \
var testing = document.getElementById("compose_editorArea");\
var doc =testing.contentDocument; \
vat text = doc.body.innerHTML; \
alert(text);}';
document.getElementsByTagName("head")[0].appendChild(scriptElement);
window.addButton = function () {
// Get the location on the page where you want to create the button
var targetDiv = document.getElementById('navcontainer');
// Create a div to surround the button
var newDiv = document.createElement('div');
newDiv.setAttribute('id', 'SendEN');
// Create the button and set its attributes
var inputButton = document.createElement('input');
inputButton.name = 'SendEN';
inputButton.type = 'button';
inputButton.value = 'SendEN';
inputButton.setAttribute("onclick", "checkForvalue();");
// Append the button to the div
newDiv.appendChild(inputButton);
targetDiv.appendChild(newDiv);
Thanks a lot for Helping sir!
M almost done.I m able to read and write the compose box.But writing is being done explicitly.i want to put this function for encoding.How to do?
M getting errors..
function encode(text) { Ref="0123456789abcdefghijklmnopqrstuvwxyz.-~ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Result=""
for (Count=0; Count<text.length; Count++) {
Char=text.substring (Count, Count+1);
Num=Ref.indexOf (Char);
EncodeChar=Ref.substring(Num+1, Num+2)
Result += EncodeChar
} document.form1.result.value=Result
}
Bookmarks