Page 1 sur 1

imcompatibilité avec firefox

Posté : 29 sept. 2009, 10:10
par Invité
Bonjour,

J'ai un souci j'ai fais des formulaires sous internet explorer et je n'ai aucun souci, par contre avec firefox rien n'est mis en page de même qu'il ne prend pas en compte mon code ajax/ javascript. Comment doit-je faire pour que se soit compatible.

merci

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 10:33
par jojolapine
Bonjour,

peut-être commencer par nous montrer le code utilisé? (html/css/js/php)

Re: incompatibilité avec firefox

Posté : 29 sept. 2009, 10:37
par Invité
je n'avais pas montrer de code car je savais pas trop quoi vous monter.
ma feuille de style css :
body { background:#FFFFFF; color:#000000; font-size:14px; font-family:Tahoma; }
a:link { color:#000066; text-decoration:none; font-weight:normal; }
a:visited { color:#006633; text-decoration:none; font-weight:normal; }
h1 { font-family:Tahoma; font-size:30px; color:#000000; text-decoration:none; font-weight:bold; text-align:center; }
h2 { font-family:Tahoma; font-size:24px; color:#000000; text-decoration:none; font-weight:bold; text-align:center;}
h3 { font-family:Tahoma; font-size:16px; color:#000000; text-decoration:none; font-weight:bold; text-align:center;}
h4 { font-family:Tahoma; font-size:14px; color:#000000; text-decoration:none; font-weight:bold; text-align:center;}
th { font-size:14px; color:#000000; font-weight:bold; text-align:center; font-family:Tahoma; }
td { font-size:12px; color:#000000; text-align:center; font-family:Tahoma; }
LABEL { DISPLAY: inline ; ; WIDTH: 170px ; font-family:Tahoma; font-size:14px; }
SELECT { DISPLAY: inline ;  WIDTH: 170px ; font-family:Tahoma; text-align:left;  }
textarea {  style=FONT-SIZE: 10pt; FONT-FAMILY: Tahoma;}
hinact { font-family:Tahoma; font-size:36px; color:#FF0000; text-decoration:none; font-weight:bold; text-align:center;}
div#bandeau {
	width: 100%;
	height: 10%;
	}
div#contenu {
	float:left;
	width: 90%;
	height: 90%;
	}
div#menu {
	float:left;
	width: 10%;
	height: 90%;
	}
div#bandeau2 {
	width: auto;
	height: auto;
	}
div#contenu2 {
	float:left;
	width: 80%;
	height: auto;
	}
div#menu2 {
	float:left;
	width: auto;
	height: auto;
	}

une de mes fenetres :
nouv_rapport.php
<?php 
session_start(); 
if ($_SESSION['login'])
{
	if ($_SESSION['type']=='rapport') {
?>
<html>
<head>
<script language="JavaScript1.2" src="masks.js"></script>
<script src="ajax.js" type="text/javascript"></script>
<script src="prototype.js" type="text/javascript"></script>
<script language="javascript">
function verif_vides(enreg) {
if(document.enreg.nom.value=='') {
alert('Le champ nom doit etre rempli !');
document.enreg.nom.focus();
return false;
}
if(document.enreg.prenom.value=='') {
alert('Le champ prenom doit etre rempli !');
document.enreg.prenom.focus();
return false;
}
if(document.enreg.login.value=='') {
alert('Le champ login doit etre rempli !');
document.enreg.login.focus();
return false;
}
if(document.enreg.mdp.value=='') {
alert('Le champ mot de passe doit etre rempli !');
document.enreg.mdp.focus();
return false;
}
}
<!--
function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

// -->
</script>


<title>Enregistement d'un nouveau rapport</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
	font-family: Tahoma;
}
-->
</style><link rel="stylesheet" type="text/css" href="style.css">
</head>
<body onload="FP_preloadImgs(/*url*/'image/bouton/enregistrer.gif',/*url*/'image/bouton/enregistrer2.gif');">




<a href="javascript:history.go(-1)"><img src="image/bouton/precedent.gif" width="41" height="25" border="0"></a>
<form name="enreg"  onSubmit="return verif_vides(this)" method="post" action="index.php?page=rapportAdd">

<p><label>Nom</label><input name="nom" type="text" id="nom" size="50" maxlength="60">
</p>
<p><label>Prenom</label><input name="prenom" type="text" id="prenom" size="50" maxlength="50">
</p>
<p><label>Login</label><input name="login" type="text" id="login" size="20" maxlength="20"  onKeyUp="verifPseudo(this.value)">
</p>
<div id="pseudobox"></div>
<p><label>Mot de passe</label><input name="mdp" type="text" id="mdp" size="20" maxlength="20">
</p>
<p align="center">
    <input name="sub" border="0" id="img99" type="image" src="image/bouton/enregistrer3.gif" height="20" width="100" alt="Enregistrer" onmouseover="FP_swapImg(1,0,/*id*/'img99',/*url*/'image/bouton/enregistrer.gif')" onmouseout="FP_swapImg(0,0,/*id*/'img99',/*url*/'image/bouton/enregistrer3.gif')" onmousedown="FP_swapImg(1,0,/*id*/'img99',/*url*/'image/bouton/enregistrer2.gif')" onmouseup="FP_swapImg(0,0,/*id*/'img99',/*url*/'image/bouton/enregistrer.gif')" fp-style="fp-btn: Glass Capsule 2; fp-transparent: 1" fp-title="Enregistrer">
</p>
</form>
</boby>
</html>
<?php } else { 
echo "Vous n'êtes pas autorisé à accèder à cette page"; 
} 
} else { 
header("Location: accueil.php"); } ?>
est-ce que cela convient ?

merci

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 10:50
par jojolapine
Bon déjà, pourquoi ne pas uniformiser tes appels aux script js?

Code : Tout sélectionner

<script language="JavaScript1.2" src="masks.js"></script> <script src="ajax.js" type="text/javascript"></script>
Ensuite, qu'est-ce que tu entends par:
qu'il ne prend pas en compte mon code ajax/ javascript
Le fichier est-il trouvé? tu as des erreurs js?

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 11:10
par Invité
qu'est-ce que tu entend par : pourquoi ne pas uniformiser tes appels aux script js ?

quand j'ai écrit qu'il ne prend pas en compte mon code ajax/ javascript, c'est que mon code reste brute ni le css est pris en compte est mes script ne sont pas du tout pris en compte. je n'ai pas de message d'erreur. et sous internet explorer je n'ai aucun souci, tout fonctionne parfaitement.

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 11:18
par jojolapine
Est-ce que tu as essayé ce que je t'ai demandé ? (uniformiser ton appel à mask.js de la même manière que tes autres fichiers js...

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 12:10
par Invité
j'ai essayé d'uniformiser mon appel a mask.js mais ça ne change rien

merci

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 12:14
par jojolapine
Fait nous voir du code!!!!
En l'occurence le code modifié... :roll:

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 12:38
par Victor BRITO
Vu certaines portions de code, j'ai comme l'impression que ça sent la génération de code par un éditeur WYSIWYG de type FrontPage ou Dreamweaver. :roll: Il vaut toujours mieux d'utiliser un éditeur de texte, comme Notepad ++ : au moins, tu restes maître de ton code. ;)

En outre, en ce qui concerne la mise en page, il vaut mieux déclarer un doctype, ce qui n'est visiblement pas le cas ici ; or, en l'absence de doctype, les navigateurs basculent vers un mode de rendu appelé mode Quirks, qui a de lourdes conséquences sur l'affichage d'une page (une suggestion de lecture : Le doctype pour HTML 4 et 5 et XHTML).

Quant au code JavaScript, je te conseille d'apprendre le DOM JavaScript (Mozilla fournit une documentation en ligne à ce sujet) ou bien d'utiliser une bibliothèque comme jQuery (qui tient compte des problèmes de compatibilité entre navigateurs).

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 14:14
par Invité
pour répondre a victor brito j'ai utiliser front page pour la parti de code qui affiche les boutons. Sinon j'utilise dreamweaver mais je ne fais pas appel a la parti creation, j'utilise la parti code. pour la parti javascript se sont des script que j'ai pompé d'internet et modofoé afin de faire afficher de la manière dont je souhaitais. J'en utilise très peu.

concernant le code que j'ai modifié j'ai donc modifié :
<script language="JavaScript1.2" src="masks.js"></script> 
en
<script src="masks.js" type="text/javascript"></script>
. Et suite au conseil de victor brito j'ai ajouté
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	   "http://www.w3.org/TR/html4/strict.dtd">
	   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	   "http://www.w3.org/TR/html4/loose.dtd">	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
	   "http://www.w3.org/TR/html4/frameset.dtd">
cela me fais donc :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	   "http://www.w3.org/TR/html4/strict.dtd">
	   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	   "http://www.w3.org/TR/html4/loose.dtd">	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
	   "http://www.w3.org/TR/html4/frameset.dtd"><?php 
session_start(); 
if ($_SESSION['login'])
{
	if ($_SESSION['type']=='telepro') {
?>
<html>
<head>
<script src="masks.js" type="text/javascript"></script>
<script src="ajax.js" type="text/javascript"></script>
<script language="javascript">
function verif_vides(enreg) {
if(document.enreg.datrdv.value=='') {
alert('Le champ date doit etre rempli !');
document.enreg.datrdv.focus();
return false;
}
if(document.enreg.hrrdv.value=='') {
alert('Le champ heure doit etre rempli !');
document.enreg.hrrdv.focus();
return false;
}
}
function init()
{
   // Création du masque date jj/mm/aaaa
   oDateMask = new Mask("jj/mm/aaaa", "date");
   oHeureMask = new Mask("##:##:00", "number");
   // Associer le oDateMask aux 2 champs
   oDateMask.attach(document.enreg.datrdv);
   oHeureMask.attach(document.enreg.hrrdv);
}

<!--
function FP_swapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
init();
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

// -->
</script>


<title>Enregistement d'un nouveau representant</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
	font-family: Tahoma;
}
-->
</style><link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
.Style1 {font-family: Wingdings}
-->
</style>
</head>
<body onload="FP_preloadImgs(/*url*/'image/bouton/enregistrer.gif',/*url*/'image/bouton/enregistrer2.gif');">
<?php
if(isset($_GET['num_prospect']))
{ $num_prospect=$_GET['num_prospect'];
}
if(isset($_GET['num_representant']))
{ $num_representant=$_GET['num_representant'];
}
?>
<a href="javascript:history.go(-1)"><img src="image/bouton/precedent.gif" width="41" height="25" border="0"></a>
<form name="enreg"  onSubmit="return verif_vides(this)" method="post" action="index.php?page=rdvAdd">
<input name="num_prospect" type="hidden" id="num_prospect" value="<?php echo $num_prospect; ?>">
<input name="num_representant" type="hidden" id="num_representant"  value="<?php echo $num_representant; ?>">

<p><?php echo '<select size=1 name="num_representant">>'."\n"; 
    $reqsql2 = mysql_query("SELECT nom_representant, prenom_representant
		  FROM representant
WHERE num_representant='$num_representant'");
while ($nom = @mysql_fetch_object($reqsql2)) {
			$nomr = $nom->nom_representant;
			$prenomr = $nom->prenom_representant;   
echo '<option value='.$num_representant.'>'; echo $nomr.' '.$prenomr;'<option>'."\n"; 
 }  
 $req = mysql_query('SELECT distinct num_representant, nom_representant, prenom_representant FROM representant WHERE inactif_representant=0 ORDER BY `nom_representant`, prenom_representant') ;  
while($data = mysql_fetch_assoc($req))
{ ?>
          
        <option value="<?php echo ($data['num_representant']) ; ?>"><?php echo ($data['nom_representant'].' '.$data['prenom_representant']); ?> </option>    
   <?php            
} ?></select></p>
<p><label>RDV le </label><input name="datrdv" type="text" id="datrdv" size="10" maxlength="10"> à <input name="hrrdv" type="text" id="hrrdv" size="8" maxlength="8" onClick="afficherdv()"></p>
<p><h4 id="ind"></h4></p>

<?php
$reqsql = mysql_query("SELECT num_prospect, nom_prospect, prenom_prospect, ad_rue, cp_ville, ville, telephone, sexe, sexe_prospect, age, douleur, age_conj, douleur_conj, pb_particulier, detail_ad  FROM prospect, ville WHERE prospect.num_insee=ville.num_insee AND num_prospect=$num_prospect");
while ($row = mysql_fetch_row($reqsql)) {
?>



<p><label>Nom et adresse</label><?php echo $row[1].' '.$row[2]; ?></p>
<p><label></label><?php echo $row[3]; ?></p>
<p><label></label><?php echo $row[4].' '.$row[5]; ?></p>
<p><label>Téléphone</label><?php echo $row[6]; ?></p>
<p><label>Contact téléphonique</label><?php switch($row[7])
    {
    case 'H':
        $sx='H';
        $sf='';
        break;
    case 'F':
        $sx='F';
        $sf='';
        break;
    case 'HF':
        $sx=$row[8];
        $sf='';
        break;
    case 'HV':
        $sx='H';
        $sf='veuf';
        break;
    case 'FV':
        $sx='F';
        $sf='veuve';
        break;
    case 'HC':
        $sx='H';
        $sf='célibataire';
        break;
    case 'FC':
        $sx='F';
        $sf='célibataire';
        break;
    } echo $sx.' '.$sf; ?></p>
<p><label>Age & douleur</label><?php echo $sx.' '.$row[9].' '.$row[10];  ?></p>
<?php if ($row[7]=='HF') { 
if ($sx=='H') { $sxc='F'; } else { $sxc='H'; }
?>  
<p><label></label><?php echo $sxc.' '.$row[11].' '.$row[12];  ?></p>
<?php } ?>
<p><label>Pb particulier</label><?php echo $row[13]; ?></p>
<p><label>Detail adresse</label><?php echo $row[14]; ?></p>
<?php } ?>
<p align="center">
    <input name="sub" border="0" id="img99" type="image" src="image/bouton/enregistrer3.gif" height="20" width="100" alt="Enregistrer" onmouseover="FP_swapImg(1,0,/*id*/'img99',/*url*/'image/bouton/enregistrer.gif')" onmouseout="FP_swapImg(0,0,/*id*/'img99',/*url*/'image/bouton/enregistrer3.gif')" onmousedown="FP_swapImg(1,0,/*id*/'img99',/*url*/'image/bouton/enregistrer2.gif')" onmouseup="FP_swapImg(0,0,/*id*/'img99',/*url*/'image/bouton/enregistrer.gif')" fp-style="fp-btn: Glass Capsule 2; fp-transparent: 1" fp-title="Enregistrer">
</p>
</form>
</boby>
</html>
<?php } else { 
echo "Vous n'êtes pas autorisé à accèder à cette page"; 
} 
} else { 
header("Location: accueil.php"); } ?>
mais suite a cela j'ai aucun changement.

bon en regardant bien ça me laisse pas le texte brut, j'ai la police qui ai bien pris en compte par exemple, mais les caractéristiques pour le reste ne focntionne pas, par exemple, les label ne fonctionne pas.
de même que mes codes javascript , ma fonction verif_vides(enreg), FP_swapImg(), FP_preloadImgs(), FP_getObjectByID(id,o) fonctionne, grace a un alert je vois qu'il rentre bien dans mon init(), mais il ne fais pas se qui ai demandé dans le code. De même il rentre dans mon masks.js, et dans mon ajax.js.
mais il ne rentre pas dans ma fonction dans mon ajax.js.
je rappelle que tout ça fonctionne parfaitement sous internet explorer.

merci

Re: imcompatibilité avec firefox

Posté : 29 sept. 2009, 16:20
par Victor BRITO
Et suite au conseil de victor brito j'ai ajouté
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	   "http://www.w3.org/TR/html4/strict.dtd">
	   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	   "http://www.w3.org/TR/html4/loose.dtd">	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
	   "http://www.w3.org/TR/html4/frameset.dtd">
cela me fais donc :
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
	   "http://www.w3.org/TR/html4/strict.dtd">
	   
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	   "http://www.w3.org/TR/html4/loose.dtd">	

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
	   "http://www.w3.org/TR/html4/frameset.dtd"><?php 
session_start(); 
if ($_SESSION['login'])
{
	if ($_SESSION['type']=='telepro') {
?>
<html>
Il ne faut choisir qu'un seul doctype (vu ton code, je te conseille d'utiliser le doctype HTML 4.01 Transitional). ;)

Re: imcompatibilité avec firefox

Posté : 30 sept. 2009, 08:55
par Invité
ok merci, j'ai corriger mon code.
mais j'ai toujours mon problème de compatibilité.
merci

Re: imcompatibilité avec firefox

Posté : 30 sept. 2009, 09:08
par Victor BRITO
Tu parles de problème de compatibilité avec Firefox alors ton JavaScript fonctionne sans problème sous IE. En me basant sur cette affirmation, je me dis qu'il y a certainement un problème de méthodologie : en effet, il vaut mieux coder d'abord pour Firefox (et les autres navigateurs qui respectent les standards du Web), et ensuite vérifier sous IE et apporter les correctifs, si besoin est, pour IE. En procédant ainsi, tu auras plus de chances de produire du code compatible avec n'importe quel navigateur.

En ce qui concerne ton souci de validation de formulaire en JavaScript, tu peux t'inspirer d'un article d'Openweb intitulé Bien valider ses formulaires avec JavaScript.