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


Groups > comp.lang.javascript > #30140

Re: onload and onclick

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Aleksandro <aleksandro@gmx.com>
Newsgroups comp.lang.javascript
Subject Re: onload and onclick
Date Mon, 28 Mar 2016 18:33:40 -0300
Organization A noiseless patient Spider
Lines 35
Message-ID <ndc7pi$m50$3@dont-email.me> (permalink)
References <ndb6qc$evs$1@gioia.aioe.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
Injection-Date Mon, 28 Mar 2016 21:30:27 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="10ff5083027c7d1fb29108c9b27f70f4"; logging-data="22688"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ekjMvfmF9YWPGL14u0w1Lb3vPLyb/0SA="
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1
In-Reply-To <ndb6qc$evs$1@gioia.aioe.org>
Cancel-Lock sha1:MM3pzFFfdZf4eUhHArhtfYWs8tc=
Xref csiph.com comp.lang.javascript:30140

Show key headers only | View raw


On 28/03/16 09:07, emf wrote:
> The eye exercises at:
> 
> http://emf.neocities.org/ix/ix.html
> 
> are working fine (after I was finally able to upload all the files I
> wanted) My question revers to he function that fires them:
> 
> window.onload = function () {
>     "use strict";
>     document.getElementById("start").onclick = function () {
>         requestFullScreen();
>         init();
>     };
> };
> 
> I arrived at this solution after deciding to remove any JS code from the
> HTML code. It works fine, however it looks a little too complicated for
> my personal taste. Is there a simpler way to write it?

"use strict"

window.addEventListener("DOMContentLoaded", attachListener)

function attachListener ()
{
	document.gelElementById("start").addEventListener(requestEvent)
}

function requestEvent ()
{
	requestFullScreen()
	init()
}

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


Thread

onload and onclick emf <emfril@gmail.com> - 2016-03-28 08:07 -0400
  Re: onload and onclick Stefan Weiss <krewecherl@gmail.com> - 2016-03-28 22:47 +0200
    Re: onload and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-28 23:23 +0200
      Re: onload and onclick Frank Kozuschnik <franko@nurfuerspam.de> - 2016-03-29 00:20 +0200
        Re: onload and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-29 00:43 +0200
      Re: onload and onclick Stefan Weiss <krewecherl@gmail.com> - 2016-03-29 00:57 +0200
        Re: onload and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-29 02:04 +0200
          Re: onload and onclick Stefan Weiss <krewecherl@gmail.com> - 2016-03-29 04:47 +0200
            Re: onload and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-31 20:06 +0200
              Re: onload and onclick Aleksandro <aleksandro@gmx.com> - 2016-03-31 15:37 -0300
              Re: onload and onclick Stefan Weiss <krewecherl@gmail.com> - 2016-04-02 01:43 +0200
    Re: onload and onclick Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-29 00:33 +0200
    Re: onload and onclick Stefan Weiss <krewecherl@gmail.com> - 2016-03-29 05:03 +0200
    Re: onload and onclick emf <emfril@gmail.com> - 2016-03-29 01:45 -0400
  Re: onload and onclick Aleksandro <aleksandro@gmx.com> - 2016-03-28 18:33 -0300

csiph-web