Hi all, thanks for taking the time to read this.
I have an auto-generated iframe and i need to know when a user clicks inside the iframe and also when they select some text so that I can display suitable editing buttons (if you havent already guessed - its an rte)
On the page is a simple div which has the iframe appended to it, so Iam assuming that I need to add the event handlers to the iframe creation code …
function def(){
var testframe = document.createElement("iframe");
testframe.setAttribute('name', 'textEditor');
testframe.setAttribute('id', 'textEditor');
testframe.style.width = '740px';
testframe.style.height = '240px';
testframe.style.background = '#ffffff';
if (testframe.addEventListener){
testframe.addEventListener("load",function(e){this.contentWindow.document.designMode = "on";}, false);
} else if (testframe.attachEvent){
testframe.attachEvent("load", function(e){this.contentWindow.document.designMode = "on";});
}
testframe = document.getElementById('editor').appendChild(testframe);
textEditor.document.designMode="on";
textEditor.document.open();
textEditor.document.write('<head><style type="text/css">body{ font-family:arial;font-size:13px;color:black; }#basez{ clear:both;width:100%; }</style></head>');
textEditor.document.write('<div id="basez"></div>');
textEditor.document.close();
textEditor.focus();
}
Any help greatly appreciated.