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


Groups > comp.lang.javascript > #23107

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

Message-ID <7374037.s4EfTAcK1v@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2014-02-16 11:01 +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> <1570702.W5tESRjSNo@PointedEars.de> <2eec8d0c-4e94-4ef3-af37-a3e59f53768b@googlegroups.com>

Show all headers | View raw


justaguy wrote:

[fixed quotation having attribution novel and interleaved empty lines]

> [..] Thomas 'PointedEars' Lahn wrote:
>> 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"?
> 
> Sorry, typo,
>> fc.body.innerHTML = Ed.body.innerHTML + ' ' + stuff;
> should have been
>> fc.body.innerHTML = fc.body.innerHTML + ' ' + stuff;

OK, but as long as there is the ID mismatch, it is not going to work because 
execution will not reach that line.

Use a fixed-width font for display.  And not the b0rken, spammed Google 
Groups for posting to Usenet.  Probably someone has told you that before.

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