var scriptElement = document.createElement('script');
scriptElement.type = 'text/javascript';
scriptElement.innerHTML ='function checkForvalue() { \
var testing = document.getElementById("compose_editorArea"); \
var doc = testing.contentDocument; \
alert(doc);}';
/scriptElement.innerHTML ='function checkForvalue() { alert("WELCOME TO CAIR"); }';/
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', 'autoCheckOrder');
// Create the button and set its attributes
var inputButton = document.createElement('input');
inputButton.name = 'autoCheckOrderButton';
inputButton.type = 'button';
inputButton.value = 'SendEN';
inputButton.setAttribute("onclick", "checkForvalue();");
// Append the button to the div
newDiv.appendChild(inputButton);
targetDiv.appendChild(newDiv);
}
addButton();
I m trying to read the contents of compose box in yahoo mail on pressing a new button which is added by this code.
The thing is it is an iframe,so m gettin error as
object HTMLDocument
where as if i use to read content of text area then it is successful
the code then used is
scriptElement.innerHTML ='function checkForvalue() { \
var testing = document.getElementById("to").value; \
alert(testing);}';
Please help,I want to read as well as write the contents of compose box on click of a button