Evenement onlload [ Framework / Ajax ]
Fermé
Bonjour, à tous
J'ai un soucis d'évènements javascript, mon but étant d'utiliser le script suivant : http://demos.mootools.net/Ajax_Timed
Il fonctionne sur mon site mais je voulais que le script ne se lance pas sur l'action du bouton start, mais au chargement de la page.
J'ai essayé de remplacer 'click' par 'onLoad' à la ligne 25 mais rien y fait.
Voila je ne connais pas très bien JS si quelqu'un pouvait m'aider il serrait le bienvenu.
J'ai un soucis d'évènements javascript, mon but étant d'utiliser le script suivant : http://demos.mootools.net/Ajax_Timed
Il fonctionne sur mon site mais je voulais que le script ne se lance pas sur l'action du bouton start, mais au chargement de la page.
J'ai essayé de remplacer 'click' par 'onLoad' à la ligne 25 mais rien y fait.
Voila je ne connais pas très bien JS si quelqu'un pouvait m'aider il serrait le bienvenu.
A voir également:
- Evenement onlload [ Framework / Ajax ]
- Net framework 4.0 - Télécharger - Divers Utilitaires
- Framework 2.0 - Télécharger - Divers Utilitaires
- Évènement facebook disparu - Forum Facebook
- Aop framework ✓ - Forum Logiciels
- Evenement whatsapp - Accueil - WhatsApp
2 réponses
Ok dsl , la solution :
// start and stop click events
/* start.addEvent('click', function(e) {
// prevent default
new Event(e).stop();*/
// prevent insane clicks to start numerous requests
$clear(periodical);
/* a bit of fancy styles */
/* stop.setStyle('font-weight', 'normal');
start.setStyle('font-weight', 'bold');*/
log.empty().addClass('ajax-loading');
/* ********************* */
// the periodical starts here, the * 1000 is because milliseconds required
periodical = refresh.periodical(timer * 1000, this);
// this is the first only request, later on will be only the periodical and refresh
// that do the request. If we don't do this way, we have to wait for 4 seconds before
// the first request.
ajax.request($time());
/* });
*/
/* stop.addEvent('click', function(e) {
new Event(e).stop();*/ // prevent default;
/* a bit of fancy styles
note: we do not remove 'ajax-loading' class
because it is already done by 'onCancel'
since we later do 'ajax.cancel()'
*/
/* start.setStyle('font-weight', 'normal');
stop.setStyle('font-weight', 'bold');*/
/* ********************* */
// let's stop our timed ajax
/* $clear(periodical);
log.removeClass('ajax-loading');
// and let's stop our request in case it was waiting for a response
ajax.cancel();
});*/
// start and stop click events
/* start.addEvent('click', function(e) {
// prevent default
new Event(e).stop();*/
// prevent insane clicks to start numerous requests
$clear(periodical);
/* a bit of fancy styles */
/* stop.setStyle('font-weight', 'normal');
start.setStyle('font-weight', 'bold');*/
log.empty().addClass('ajax-loading');
/* ********************* */
// the periodical starts here, the * 1000 is because milliseconds required
periodical = refresh.periodical(timer * 1000, this);
// this is the first only request, later on will be only the periodical and refresh
// that do the request. If we don't do this way, we have to wait for 4 seconds before
// the first request.
ajax.request($time());
/* });
*/
/* stop.addEvent('click', function(e) {
new Event(e).stop();*/ // prevent default;
/* a bit of fancy styles
note: we do not remove 'ajax-loading' class
because it is already done by 'onCancel'
since we later do 'ajax.cancel()'
*/
/* start.setStyle('font-weight', 'normal');
stop.setStyle('font-weight', 'bold');*/
/* ********************* */
// let's stop our timed ajax
/* $clear(periodical);
log.removeClass('ajax-loading');
// and let's stop our request in case it was waiting for a response
ajax.cancel();
});*/
Alain_42
Messages postés
5361
Date d'inscription
dimanche 3 février 2008
Statut
Membre
Dernière intervention
13 février 2017
894
17 avril 2008 à 22:55
17 avril 2008 à 22:55
Bonsoir,
il faut mettre dans le <body
il faut mettre dans le <body
<body onLoad="appel_fonction_js();">