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


Groups > comp.lang.javascript > #36945

Re: InnerHTML quirks

Newsgroups comp.lang.javascript
Date 2019-06-27 02:21 -0700
References <6dcae054-0a58-4000-9bb0-0be37a937500@googlegroups.com> <8b7e4e9a-6254-44c6-b06e-fdbec9930b32@googlegroups.com> <gnjcj3Fhe55U2@mid.individual.net> <9edf6537-5c4a-4259-8f47-1d6c2caad683@googlegroups.com> <gnjejeFhsacU1@mid.individual.net>
Message-ID <d45d565c-0875-4261-aafd-655c18962bb2@googlegroups.com> (permalink)
Subject Re: InnerHTML quirks
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den torsdag 27 juni 2019 kl. 10:55:17 UTC+2 skrev Arno Welzel:
> On 27.06.19 10:53, Jonas Thörnvall wrote:
> 
> > Den torsdag 27 juni 2019 kl. 10:20:56 UTC+2 skrev Arno Welzel:
> >> On 27.06.19 08:00, Jonas Thörnvall wrote:
> >>
> >>> I have tried
> >>>   document.getElementById('selBank').selectedIndex.innerHTML = 4	;
> >>
> >> This is nonsense!
> >>
> >> You can either read it the index:
> >>
> >> myindex = document.getElementById('selBank').selectedIndex;
> >>
> >> or set it:
> >>
> >> document.getElementById('selBank').selectedIndex = 4;
> >>
> >> But using "innerHTML" is nonsense! Why do you even think, that
> >> "innerHTML" is used to set the index?
> >>
> >>
> >>
> >> -- 
> >> Arno Welzel
> >> https://arnowelzel.de
> > 
> > When you generate an option list dynamically and insert it with innerHTML
> 
> Yes - than it *is* HTML.
> 
> But the index is *not* HTML! It is just a number which you assign to the
> property "selectedIndex".
> 
> > The "dynamically generated id selBank" is not available from main
> > Thus your suggested.
> > document.getElementById("selBansk").selectedIndex = 1; 
> > 
> > Will not work...
> 
> That's why I also suggested adding the "selected" attribute for the
> selected option when you generate the HTML code.

Honestly Arno why the fuck would one have to do that, and that will only work for initiation, you could never use it to select any  
 
> -- 
> Arno Welzel
> https://arnowelzel.de

Well i retract everything i said... It works perfectly well.
It was some months since i wrote the code and now i found, in code.

defaultBank=0;
document.getElementById("selBank").selectedIndex = defaultBank;
ListBankInstruments(defaultBank);

That is why it refused to change... It changed back...

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


Thread

InnerHTML quirks Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-26 22:51 -0700
  Re: InnerHTML quirks Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-26 23:00 -0700
    Re: InnerHTML quirks Arno Welzel <usenet@arnowelzel.de> - 2019-06-27 10:20 +0200
      Re: InnerHTML quirks Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-27 01:53 -0700
        Re: InnerHTML quirks Arno Welzel <usenet@arnowelzel.de> - 2019-06-27 10:55 +0200
          Re: InnerHTML quirks Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-27 02:21 -0700
            Re: InnerHTML quirks Arno Welzel <usenet@arnowelzel.de> - 2019-06-27 17:26 +0200
        Re: InnerHTML quirks Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-27 01:59 -0700
          Re: InnerHTML quirks Arno Welzel <usenet@arnowelzel.de> - 2019-06-27 11:01 +0200
  Re: InnerHTML quirks Arno Welzel <usenet@arnowelzel.de> - 2019-06-27 10:18 +0200
    Re: InnerHTML quirks Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-06-27 01:43 -0700
      Re: InnerHTML quirks Arno Welzel <usenet@arnowelzel.de> - 2019-06-27 11:00 +0200
        Re: InnerHTML quirks Silvio <silvio@internet.com> - 2019-06-27 15:05 +0200

csiph-web