This is 2 Written,one for IE,it is wrong,and one for webkit,
I have a textarea,it’s id is “web_editor_con2”,
I want to make a web editor,when i try to upload picture,
it use “<form action='./upload.php' method='post' target='file_frame' enctype="multipart/form-data"><iframe name="file_frame" style="display:none;"></iframe>“
upload.php has the code
echo '<script>
if (parent.document.all) {
parent.document.getElementById("web_editor_con2").value += "[img=' . $this->conf['SITE'] . "/Public/upload/" . $newpic . '][/img]";
}else {
var obj = parent.document.getElementById("web_editor_con2");
var startPos = obj.selectionStart;
var endPos = obj.selectionEnd;
parent.document.getElementById("web_editor_con2").value = obj.value.substring(0, startPos) + "[img=' . $this->conf['SITE'] . "/Public/upload/" . $newpic . '][/img]" + obj.value.substring(endPos);
}</script>';
Can You Have a try to make ie work well?
This is a jQuery Tutorial that works in Chrome and EI (from what i have tested)
http://docs.jquery.com/Tutorials:Mouse_Position
Example Code from The tutorial:
I hope this helps!