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


Groups > comp.lang.javascript > #30140

Re: onload and onclick

From Aleksandro <aleksandro@gmx.com>
Newsgroups comp.lang.javascript
Subject Re: onload and onclick
Date 2016-03-28 18:33 -0300
Organization A noiseless patient Spider
Message-ID <ndc7pi$m50$3@dont-email.me> (permalink)
References <ndb6qc$evs$1@gioia.aioe.org>

Show all headers | 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