Js frmwk prototype : chargement de page
Résolu
marholyne
-
marholyne -
marholyne -
Bonjour,
Je ne vois pas trop la différence entre cette écriture :
document.observe("dom:loaded", function() {...});
et celle-ci :
Event.observe(window,'load',function(){ ...});
ou est-ce le même événement qui est intercepté ?
Je ne vois pas trop la différence entre cette écriture :
document.observe("dom:loaded", function() {...});
et celle-ci :
Event.observe(window,'load',function(){ ...});
ou est-ce le même événement qui est intercepté ?
Configuration: Windows XP Opera 9.80
A voir également:
- Js frmwk prototype : chargement de page
- Js/packed.agent.n ✓ - Forum Virus
- Js echo ✓ - Forum PHP
- Arrondir js ✓ - Forum Windows
- Arrondi js ✓ - Forum Windows
- Détection de JS:Agent-EAA[Trj] ✓ - Forum Antivirus
2 réponses
C'est +/- la même chose.
En gros, ça correspont au moment où la page est totalement chargée (window.onload en JS "traditionnel").
En gros, ça correspont au moment où la page est totalement chargée (window.onload en JS "traditionnel").
marholyne
Est-ce-que ça a une différence au niveau du chargement des images par exemple ?
http://prototypejs.org/api/document/observe
Ce sont les mêmes évènements, c'est-à-dire "quand DOM est chargé".
Ce sont les mêmes évènements, c'est-à-dire "quand DOM est chargé".
en testant :
<script language="JavaScript" src="/lib/prototype/prototype_161.js"></script>
<script language="JavaScript">
Event.observe(window,'load',toto);
Event.observe(window,'load',function(){alert('titi');});
document.observe("dom:loaded", function() {alert('dom:loaded');})
function toto(){alert('toto');}
</script>
order affichage
sous FFx : dom:loaded puis toto puis titi
sous opéra : idem
sous IE : dom:loaded puis tit puis toto ( faut tjs que IE se distingue ...)
bizarre quand même
<script language="JavaScript" src="/lib/prototype/prototype_161.js"></script>
<script language="JavaScript">
Event.observe(window,'load',toto);
Event.observe(window,'load',function(){alert('titi');});
document.observe("dom:loaded", function() {alert('dom:loaded');})
function toto(){alert('toto');}
</script>
order affichage
sous FFx : dom:loaded puis toto puis titi
sous opéra : idem
sous IE : dom:loaded puis tit puis toto ( faut tjs que IE se distingue ...)
bizarre quand même