Programmation HTML
pierre
-
zangre01 Messages postés 7 Date d'inscription Statut Membre Dernière intervention -
zangre01 Messages postés 7 Date d'inscription Statut Membre Dernière intervention -
Je suis en train de développer un site WEB (HTML) qui fait appel à des sous-routine sur des évenements de type onclick. L'une de mes fonction contient une boucle avec des conditions. Selon les conditions, j'aimerais modifier sur la page WEB des images. Le problème est que tant que la sous-routine n'est pas terminée, la page n'est pas modifiée et même elle n'est plus accessible (freeze).
Avez-vous une idée par pallier à ce problème ?
Avez-vous une idée par pallier à ce problème ?
A voir également:
- Programmation HTML
- Editeur html - Télécharger - HTML
- Application de programmation - Guide
- Espace html ✓ - Forum HTML
- [**] Balise pour un espace vide en hml. Merci ✓ - Forum Webmastering
- Html download - Télécharger - HTML
3 réponses
J'essaierai peut être de découper la grosse boucle en plusieurs petites, mais c'est pas garanti que ça marche.
Les images ne sont misent à jour qu'à la fin de la boucle?
Les images ne sont misent à jour qu'à la fin de la boucle?
Tu pourrais nous donner le code source JavaScript qu'on regarde ça un peu plus précisément ?
En fait, il s'agit d'une sous-routine en Perl (pour des questions de simplicité et de multi-environnements):
---------------------------------------------------------------------------
use Win32;
use Win32::PingICMP;
sub doRestart {
$TheForm = $_[0];
my $p = Win32::PingICMP->new();
for ($i = 0 ; $i < $TheForm->selection->length ; $i++) {
if (($TheForm->selection($i)->type eq "radio") && ($TheForm->selection($i)->checked)) {
if ($TheForm->selection($i)->value eq "all") {
for ($j = 1 ; $j < $TheForm->selection->length ; $j++) {
$application = $TheForm->selection($j)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,1)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 0) || ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 1) && ($t == 40));
if($t != 40) {
$IMG = '../../images/started.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be restarted.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
}
else {
$application = $TheForm->selection($i)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,1)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until (($result == 0) || ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until (($result == 1) || ($t == 40));
if($t != 40) {
$IMG = '../../images/started.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be restarted.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
last;
}
}
if ($i >= $TheForm->selection->length) {
alert("Please select a server to restart.");
}
}
sub doStop {
$TheForm = $_[0];
my $p = Win32::PingICMP->new();
for ($i = 0 ; $i < $TheForm->selection->length ; $i++) {
if (($TheForm->selection($i)->type eq "radio") && ($TheForm->selection($i)->checked)) {
if ($TheForm->selection($i)->value eq "all") {
for ($j = 1 ; $j < $TheForm->selection->length ; $j++) {
$application = $TheForm->selection($j)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,0)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 0) && ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
}
else {
$application = $TheForm->selection($i)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,0)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 0) && ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
last;
}
}
if ($i >= $TheForm->selection->length) {
alert("Please select a server to stop.");
}
}
---------------------------------------------------------------------------
use Win32;
use Win32::PingICMP;
sub doRestart {
$TheForm = $_[0];
my $p = Win32::PingICMP->new();
for ($i = 0 ; $i < $TheForm->selection->length ; $i++) {
if (($TheForm->selection($i)->type eq "radio") && ($TheForm->selection($i)->checked)) {
if ($TheForm->selection($i)->value eq "all") {
for ($j = 1 ; $j < $TheForm->selection->length ; $j++) {
$application = $TheForm->selection($j)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,1)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 0) || ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 1) && ($t == 40));
if($t != 40) {
$IMG = '../../images/started.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be restarted.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
}
else {
$application = $TheForm->selection($i)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,1)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until (($result == 0) || ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until (($result == 1) || ($t == 40));
if($t != 40) {
$IMG = '../../images/started.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be restarted.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
last;
}
}
if ($i >= $TheForm->selection->length) {
alert("Please select a server to restart.");
}
}
sub doStop {
$TheForm = $_[0];
my $p = Win32::PingICMP->new();
for ($i = 0 ; $i < $TheForm->selection->length ; $i++) {
if (($TheForm->selection($i)->type eq "radio") && ($TheForm->selection($i)->checked)) {
if ($TheForm->selection($i)->value eq "all") {
for ($j = 1 ; $j < $TheForm->selection->length ; $j++) {
$application = $TheForm->selection($j)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,0)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 0) && ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
}
else {
$application = $TheForm->selection($i)->value;
$server = $application."server"; $machine = $TheForm->$server->value;
if(Win32::InitiateSystemShutdown($TheForm->$server->value,"",0,1,0)) {
$t = 0;
do {
sleep(5);
$result = $p->ping($machine);
$t = $t + 1;
} until(($result == 0) && ($t == 40));
if($t != 40) {
$IMG = '../../images/stopped.gif';
$flag = "img".$application;
$TheForm->$flag->{src} = $IMG;
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
else {
alert("ERROR: Server cannot be stopped.");
}
}
last;
}
}
if ($i >= $TheForm->selection->length) {
alert("Please select a server to stop.");
}
}
BONJOUR PIERRE
Moi c'est zangre aboubacar , je suis un jeune africain et je suis lycéen ,je frequente et je fait l'enseignement general et je trouve que tu est beaucoup fort tu en connait assez en informatique tu l'ecole informatique ca me plait beaucoup ce domene j'ai meme envie par moment de devenir informaticien et je profite pour te demande quand on n'est iformaticien et que on fort dans la programmation quel metier peut faire dans l'avenir .
Je serais enchanter de faire ta connaissance moi je cherche un amis avec qui ont pourras toujour rester en contact et aussi qui va m'apprendre un peu desa connaissance comme le maitre et son eleve
ok merci
mon email: zangre.aboubacar@yahoo.fr
Moi c'est zangre aboubacar , je suis un jeune africain et je suis lycéen ,je frequente et je fait l'enseignement general et je trouve que tu est beaucoup fort tu en connait assez en informatique tu l'ecole informatique ca me plait beaucoup ce domene j'ai meme envie par moment de devenir informaticien et je profite pour te demande quand on n'est iformaticien et que on fort dans la programmation quel metier peut faire dans l'avenir .
Je serais enchanter de faire ta connaissance moi je cherche un amis avec qui ont pourras toujour rester en contact et aussi qui va m'apprendre un peu desa connaissance comme le maitre et son eleve
ok merci
mon email: zangre.aboubacar@yahoo.fr