By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

Insert image from prompt

P: 21
Hi, have a problem and do not know hot to solve it.

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
  1. <html>
  2. <head>
  3. <title>image problem</title>
  4. <script type="text/javascript">
  5. <!-- 
  6. function IFO() {RT.document.designMode = 'On';}
  7.  
  8. // -- problem area
  9. // -- Needs to insert at cursor position 
  10.  
  11. function IMG() {var imgSrc = prompt('Enter image location', ''); if(imgSrc != null) { RT.document.execCommand('insertimage', false, imgSrc);}}
  12.  
  13. // -- end problem area
  14.  
  15. function submit_form() {var theForm = document.getElementById("wyfm"); theForm.elements["Entry"].value = window.frames['RT'].document.body.innerHTML; theForm.submit();}
  16. //  End -->
  17. </script>
  18.  
  19. </head>
  20. <body onLoad="IFO();" style="font-family:vardana, arial,sans serif; font-size:105%;">
  21. <br><div style="text-align:center;">
  22. <br>
  23. <form action="#" name="wyfm" id="wyfm" method="post">
  24. <input type="button" onClick="IMG()" value="Img" title="Insert image">
  25. <br><br>
  26. <textarea style="display:none;" name="Entry" id="Entry" cols="100" rows="14"></textarea>
  27. <iframe name="RT" id="RT" style="width:400px; height:200px;"></iframe>
  28. <br><br><input name="myBtn" type="button" value="Save" onClick="javascript:submit_form();">
  29. </form>
  30. </div>
  31. </body>
  32. </html>
  33.  
Hope somebody can help - thanks
Jan 15 '17 #1
Share this Question
Share on Google+
2 Replies


P: 21
No response yet.

Have been unwell and just been able to get back here.

This works in chrome okay but not in Internet Explorer. IE is the one I have to have a space and select it.

So what do I do to make it work with IE?

Thanks
Mar 12 '17 #2

gits
Expert Mod 5K+
P: 5,293
may be you can check here: https://social.msdn.microsoft.com/Fo...webdevelopment
Mar 15 '17 #3

Post your reply

Sign in to post your reply or Sign up for a free account.