how to run javascript into the editing area
capture the event of click in any point of the editing area
You are using <a href="http://www.fckeditor.net/">FCKeditor</a> This is <span id="spanTHERAError1" class="rojo" onClick="alert(hola);">newText</span>
http://www.fckeditor.net/forums/viewtopic.php?f=6&t=6509&p=17501&hilit=+onclick#p17501
You are using <a href="http://www.fckeditor.net/">FCKeditor</a></em><strong id="input1" onclick="alert('aaa');">HI</strong>

Re: [javascript running] in the text area, capture click
I'm still Julia.
I have succeedeed to capture the event of click by capturing the one of the whole document of the editor.
I give you he the successful code:
function onClickCapture () { alert ("onClickCapture"); } function FCKeditor_OnComplete ( editorInstance ) { doc = editorInstance.EditorDocument; doc.onclick = onClickCapture; }The code has to be inserted in the page that creates the editor in a javascript heading.
I insist that it's a "clean" solution because both behaviours are going to be running: the specific behaviour in the function onClickCapture, and the default one (for example detect if we are in bold tag).
Thanks to all.
Julia
Re: [javascript running] in the text area,event.srcElement ?
well it works but I can't succeed to get the source of the event...
Please would you know how to do?
Julia
Re: [javascript running] in the text area, capture click
http://www.jquery.com
Re: [javascript running] in the text area, capture click
function onClickCapture { //element = event.srcElement; //element = document.event.srcElement; //element = doc.event.srcElement; //element = window.event.srcElement; element = this.srcElement; //var event = doc.frames[0].objContent.DOM.parentWindow.event; //var event = doc.frames[0].objContent.DOM.parentWindow.event; /* editor_frame = document.getElementById(editorname+'___Frame'); editor_source = editor_frame.contentWindow.document.getElementById('eEditorArea'); editor_source.contentWindow.document.body.innerHTML += 'some text';*/ }Re: [javascript running] in the text area, capture click
Re: [javascript running] in the text area,event.srcElement ?
You almost got it right the first time, but you didn't check for the event:
W3C compliant browsers will send it as the parameter to your function, and IE..., well, IE is IE.
function onClickCapture (e) { if (!e) e=window.event; alert ("onClickCapture"); } function FCKeditor_OnComplete ( editorInstance ) { doc = editorInstance.EditorDocument; doc.onclick = onClickCapture; }Re: [javascript running] in the text area,event.srcElement ?
Re: [javascript running] in the text area, capture click
function onClickCapture (e) { if (!e) e=window.event; var elmt = e.target || e.srcElement; alert (elmt.nodeName); } function FCKeditor_OnComplete ( editorInstance ) { var doc = editorInstance.EditorDocument.body; addEvent( doc, "click", onClickCapture ) ; } function addEvent(obj, evType, fn, useCapture){ if (obj.addEventListener){ obj.addEventListener(evType, fn, useCapture); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } }Re: [javascript running] in the text area, capture click
THANKS A LOT alfonsomi, it works!!!!
Post solved.
Re: [javascript running] in the text area, capture click