I have an insertion of an image into my editor. It works very well, but...
The image only inserts after all the text.
How can I insert the image at the cursor position?
The Javascript in a .js file (not needed for this query):
The html in my editor:
Thanks for any help.
The image only inserts after all the text.
How can I insert the image at the cursor position?
The Javascript in a .js file (not needed for this query):
Code:
function gimg(str) {var e = getRefById('Entry'), s = null, r = null; if(e) {if((s = document.selection) && s.createRange) {var repos = false; e.focus(); if((r = s.createRange())) {if(r.text.length) {repos = false;}r.text = str; if(repos && s.empty) {s.empty();}}} else {e.value += str;}} }
Code:
<img src="/$bdir/allims/$ifl" class="imtn" onclick="gimg('\\n<img src="\/$bdir\/allims\/$ifl" border="0" title="$ifl" alt="$ifl" class="blim">\\n')">
Comment