Image needs to insert where the cursor is.
I have to hit the space bar, select the space, then insert the image (works).
How do I insert the image exactly the where cursor is?
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <title>image problem</title>
- <script type="text/javascript">
- <!--
- function IFO() {RT.document.designMode = 'On';}
- // -- problem area
- // -- Needs to insert at cursor position
- function IMG() {var imgSrc = prompt('Enter image location', ''); if(imgSrc != null) { RT.document.execCommand('insertimage', false, imgSrc);}}
- // -- end problem area
- function submit_form() {var theForm = document.getElementById("wyfm"); theForm.elements["Entry"].value = window.frames['RT'].document.body.innerHTML; theForm.submit();}
- // End -->
- </script>
- </head>
- <body onLoad="IFO();" style="font-family:vardana, arial,sans serif; font-size:105%;">
- <br><div style="text-align:center;">
- <br>
- <form action="#" name="wyfm" id="wyfm" method="post">
- <input type="button" onClick="IMG()" value="Img" title="Insert image">
- <br><br>
- <textarea style="display:none;" name="Entry" id="Entry" cols="100" rows="14"></textarea>
- <iframe name="RT" id="RT" style="width:400px; height:200px;"></iframe>
- <br><br><input name="myBtn" type="button" value="Save" onClick="javascript:submit_form();">
- </form>
- </div>
- </body>
- </html>