Insert image from prompt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Roamer
    New Member
    • Dec 2012
    • 23

    Insert image from prompt

    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?

    Code:
    <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>
    Hope somebody can help - thanks
  • Roamer
    New Member
    • Dec 2012
    • 23

    #2
    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

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5390

      #3
      may be you can check here: https://social.msdn.microsoft.com/Fo...webdevelopment

      Comment

      Working...