Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #23105

Re: Why insert goes to next line instead of current cursor position

Message-ID <1570702.W5tESRjSNo@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2014-02-16 03:09 +0100
Subject Re: Why insert goes to next line instead of current cursor position
Newsgroups comp.lang.javascript
References <31cd8077-c866-4dcb-8f0b-498dc52e2824@googlegroups.com>

Show all headers | View raw


justaguy wrote:

> I have an iframe with id of "frameID" and I'd like to insert something
> into this iframe at its current cursor position (the iframe has some
> content already).  So, it looks like this: <iframe id="iframeID"...>my
                                                         ^^^^^^^^
> iframe content here...</iframe>
> 
> The js function code looks like this.
> 
> function insertAtCursorPos(stuff) {
> var f = document.getElementById('frameID');
                                   ^^^^^^^ ID mismatch
> var fc = (f.contentDocument || f.contentWindow.document);
> if (fc) {
> fc.body.innerHTML = Ed.body.innerHTML + ' ' + stuff;

What is “Ed”?

> }
> 
> I guess […]

Please don't.  Use a debugger instead, finally.

<http://www.catb.org/~esr/faqs/smart-questions.html>

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why insert goes to next line instead of current cursor position justaguy <lichunshen84@gmail.com> - 2014-02-15 17:52 -0800
  Re: Why insert goes to next line instead of current cursor position Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-02-16 03:09 +0100
    Re: Why insert goes to next line instead of current cursor position justaguy <lichunshen84@gmail.com> - 2014-02-15 18:50 -0800
      Re: Why insert goes to next line instead of current cursor position Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-02-16 11:01 +0100
        Re: Why insert goes to next line instead of current cursor position John Harris <niam@jghnorth.org.uk.invalid> - 2014-02-17 10:12 +0000
  Re: Why insert goes to next line instead of current cursor position Christoph Michael Becker <cmbecker69@arcor.de> - 2014-02-16 19:55 +0100

csiph-web