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


Groups > comp.lang.javascript > #30762

Re: Failing to get DIV content to flip between initial and alternate version

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Failing to get DIV content to flip between initial and alternate version
Date 2016-06-27 05:43 +0200
Organization PointedEars Software (PES)
Message-ID <5193546.lOV4Wx5bFT@PointedEars.de> (permalink)
References (3 earlier) <XnsA62B75F12E387eejj99@194.109.6.166> <nk4v9l$cth$1@dont-email.me> <nk69tf$2h5$1@dont-email.me> <nk8j47$uqr$1@dont-email.me> <nk8jb1$uqr$2@dont-email.me>

Show all headers | View raw


$Bill wrote:

> On 6/20/2016 04:13, $Bill wrote:
>> On 6/19/2016 07:23, Doc O'Leary wrote:
>>> For your reference, records indicate that
>>> $Bill <news@todbe.com> wrote:
>>>> But an expert would know that and what I was attempting to do was
>>>> indeed logical
>>> No, there’s really no logic in screwing with innerHTML in order to get
>>> the job done.  An expert would do something more sane, like altering the
>>> CSS display property of the elements in question.
>> You're wrong - the logic is there, the knowledge of the language/workings
>> isn't. And I'm a neophyte not an expert - what I did got the job done -
>> when I have the knowledge, I'll find better/more apropos ways to do
>> things.
> 
> BTW, if you have a better way to do it, feel free to show it instead of
> complaining about my lack of JS knowledge.  This is supposed to be a 
> learning environment.

He told you what he thinks you should do.  Which part of it do you not 
understand?  See the FAQ.

In this case, however, I think you should switch the versions by making an 
HTTP request and changing the content accordingly, either with XHR in the 
background or with the classic approach of passing a parameter to the 
server-side script, *because the data of a TV Guide can have changed in the 
meantime*.  

The former might be what you are up to; depending on the complexity of the 
presentation, indeed it might be better to request the HTML instead of just 
JSON, and replace the relevant markup instead of individual parts from the 
JSON data.  In the case of a table, you should then rewrite the whole table 
using the “innerHTML” property as that appears to be much faster than the 
alternatives.

<http://www.quirksmode.org/dom/innerhtml.html>

Note that the results there are *old*, so do your own tests with “Test now”.

And get a real name if you want to be taken seriously here.  That goes to 
all of you – this is _not_ a chat room.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


Thread

Failing to get DIV content to flip between initial and alternate version $Bill <news@todbe.com> - 2016-06-16 23:18 -0700
  Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-17 11:32 +0200
    Re: Failing to get DIV content to flip between initial and alternate version $Bill <news@todbe.com> - 2016-06-17 19:00 -0700
      Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-18 11:35 +0200
        Re: Failing to get DIV content to flip between initial and alternate version $Bill <news@todbe.com> - 2016-06-18 19:16 -0700
          Re: Failing to get DIV content to flip between initial and alternate version Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2016-06-19 14:23 +0000
            Re: Failing to get DIV content to flip between initial and alternate version $Bill <news@todbe.com> - 2016-06-20 04:13 -0700
              Re: Failing to get DIV content to flip between initial and alternate version $Bill <news@todbe.com> - 2016-06-20 04:16 -0700
                Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-26 12:53 +0200
                Re: Failing to get DIV content to flip between initial and alternate version $Bill <news@todbe.com> - 2016-06-26 16:22 -0700
                Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-27 10:49 +0200
                Re: Failing to get DIV content to flip between initial and alternate version Doc O'Leary  <droleary@2015usenet1.subsume.com> - 2016-06-27 13:58 +0000
                Re: Failing to get DIV content to flip between initial and alternate version Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-27 05:43 +0200
                Re: Failing to get DIV content to flip between initial and alternate version John Harris <niam@jghnorth.org.uk.invalid> - 2016-06-27 09:38 +0100
                Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-27 11:00 +0200
                Re: Failing to get DIV content to flip between initial and alternate version John Harris <niam@jghnorth.org.uk.invalid> - 2016-06-28 10:04 +0100
                Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-28 12:13 +0200
                Re: Failing to get DIV content to flip between initial and alternate version John Harris <niam@jghnorth.org.uk.invalid> - 2016-06-29 16:16 +0100
                Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-29 19:48 +0200
          Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-25 16:40 +0200
    Re: Failing to get DIV content to flip between initial and alternate version "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-18 10:59 -0700
      Re: Failing to get DIV content to flip between initial and alternate version Stanimir Stamenkov <s7an10@netscape.net> - 2016-06-18 22:32 +0300
        Re: Failing to get DIV content to flip between initial and alternate version "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-18 13:50 -0700
          Re: Failing to get DIV content to flip between initial and alternate version Stanimir Stamenkov <s7an10@netscape.net> - 2016-06-19 09:40 +0300
            Re: Failing to get DIV content to flip between initial and alternate version "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-19 12:21 -0700
            Re: Failing to get DIV content to flip between initial and alternate version Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-25 18:37 +0200
    Re: Failing to get DIV content to flip between initial and alternate version Stanimir Stamenkov <s7an10@netscape.net> - 2016-06-18 22:17 +0300
      Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-25 16:45 +0200
        Re: Failing to get DIV content to flip between initial and alternate version "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-25 17:17 +0200
          Re: Failing to get DIV content to flip between initial and alternate version "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-06-25 19:02 +0200

csiph-web