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


Groups > comp.lang.javascript > #31629

Re: How to reset onclick event upon event change?

Newsgroups comp.lang.javascript
Subject Re: How to reset onclick event upon event change?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <aa44f506-fa3c-4e74-9776-b53e1103a1ee@googlegroups.com> <XnsA6B1D413A9814eejj99@194.109.6.166> <1cd0bd60-3d19-4bb8-8718-a066dd9645d5@googlegroups.com>
Date 2016-10-30 21:34 +0100
Message-ID <XnsA6B1DB7CDBFCBeejj99@194.109.6.166> (permalink)

Show all headers | View raw


justaguy <lichunshen84@gmail.com> wrote on 30 Oct 2016 in
comp.lang.javascript: 

> Line 11: var h = document.getElementById('usage').value = 
> "Hide config / usage instructions";

var a = b.value = "c";

This means that:
1 the now the attribute of b that is called value contains "c".
2 that now the value a contains "c" too.

> Line 12: console.log('from top section: ' +h);    

You should see in the console:
'from top section: c' [or your real text-string]

> Line 13: h.onclick = null; 

This string 'c' [or your real text-string]
does not have a onclick listener-method!!!

[remember h contains a string: 
h = 'Hide config / usage instructions';]

[and even if it had such method, 
setting it to null would not have any effect
as you reassign it in Line 14 to something else again.

> Line 14: h.onclick = function () {

it is like:

var x;
x = null; // this line has no lasting effect!
x = 'Hi folks';
x.onclick = alert(''); // this line is nonsense!
// because: 'Hi folks' has no listener-method!


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


Thread

How to reset onclick event upon event change? justaguy <lichunshen84@gmail.com> - 2016-10-30 12:41 -0700
  Re: How to reset onclick event upon event change? justaguy <lichunshen84@gmail.com> - 2016-10-30 12:45 -0700
  Re: How to reset onclick event upon event change? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-10-30 20:50 +0100
    Re: How to reset onclick event upon event change? justaguy <lichunshen84@gmail.com> - 2016-10-30 13:09 -0700
      Re: How to reset onclick event upon event change? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-10-30 21:34 +0100
        Re: How to reset onclick event upon event change? justaguy <lichunshen84@gmail.com> - 2016-10-30 13:45 -0700
          Re: How to reset onclick event upon event change? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-10-30 22:21 +0100
            Re: How to reset onclick event upon event change? justaguy <lichunshen84@gmail.com> - 2016-10-30 15:02 -0700
              Re: How to reset onclick event upon event change? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-10-31 10:29 +0100

csiph-web