IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

compatibilité IE & FF


Sujet :

JavaScript

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    58
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 58
    Points : 49
    Points
    49
    Par défaut compatibilité IE & FF
    Bonjour,

    J'ai fait un code javascript, il fonctionne parfaitement sous FF mais sous IE c'est mort.

    Pourrais-je avoir un coup de pouce s'il vous plait.

    Merci d'avance
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    <script language="javascript">
     
    	var banniere = '';
    	var type = '';
    	function rec_banniere(x){banniere = x}
    	function rec_type(y){type = y}
    	function verif_text(e){
    		keynum = e.which
     
    		if ((keynum == 8) || (keynum >= 97 && keynum <= 122)) {
    			window.document.form1.url.value = keypress
    			return true
    		}
    		else{
    			return false
    		}
     
    		//return creat_url()
    	}
     
    	function creat_url(){
    		text = "http://"
    		text = text + banniere
    		text = text + "/"
    		text = text + type
    		text = text + "/"
    		text = text + window.document.form1.nom1.value
    		text = text + "/"
    		text = text + window.document.form1.nom2.value
    		text = text + "/"
    		text = text + window.document.form1.nom3.value
    		text = text + "/"
    		text = text + window.document.form1.nom4.value
    		text = text + "/"
    		text = text + window.document.form1.nom5.value
     
    		window.document.form1.url.value = text
    	}
     
    	function temp(e){
    		keynum = e.which
    		window.document.form1.url.value = keypress
    	}
    </script>
    </head>
     
    <body>
     
    <form name="form1">
    <input type="radio" name="banniere" value="468" onchange="return verif_text()" onclick="rec_banniere('468')"/>468
    <input type="radio" name="banniere" value="wide" onchange="return verif_text()" onclick="rec_banniere('wide')"/>wide
    <input type="radio" name="banniere" value="sky600" onchange="return verif_text()" onclick="rec_banniere('sky')"/>sky
    <input type="radio" name="banniere" value="rect300" onchange="return verif_text()" onclick="rec_banniere('rect')"/>rect
     
    <br /><br />
     
    <input type="radio" name="type" value="RG" onchange="return verif_text()" onclick="rec_type('RG')"/>Rotation
    <input type="radio" name="type" value="HP" onchange="return verif_text()" onclick="rec_type('HP')"/>Homepage
    <input type="radio" name="type" value="PHP" onchange="return verif_text()" onclick="rec_type('PHP')"/>Pré-Homepage
     
    <br /><br />
     
    Identifiant de la campagne : <input name="nom1" type="text" onkeypress="return verif_text(event)" onchange="return creat_url()" />
    <br /><br />
     
    Site Partenaire : <input name="nom2" type="text" onkeypress="return verif_text(event)" onchange="return creat_url()" />
    <br /><br />
     
    <input name="nom3" type="text" onkeypress="return verif_text(event)" onchange="return creat_url()"/>
    <br /><br />
     
    <input name="nom4" type="text" onkeypress="return verif_text(event)" onchange="return creat_url()"/>
    <br /><br />
     
    <input name="nom5" type="text" onkeypress="return verif_text(event)" onchange="return creat_url()"/>
    <br /><br />
     
    <input name="envoyer" type="button" value="envoyer" />
    <br /><br />
     
    <input name="url" type="text" size="200"/>
    </form>
    </body>

  2. #2
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 650
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 650
    Points : 11 141
    Points
    11 141
    Par défaut
    bonjour,

    - déclare tes variables !
    - mets des point-virgules à la fin de chaque instruction ;
    -
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    keynum = e.which
    essaye plutôt avec e.keyCode;
    -
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    		if ((keynum == 8) || (keynum >= 97 && keynum <= 122)) {
    			window.document.form1.url.value = keypress
    c'est quoi keypress

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    58
    Détails du profil
    Informations personnelles :
    Âge : 40
    Localisation : France

    Informations forums :
    Inscription : Juin 2006
    Messages : 58
    Points : 49
    Points
    49
    Par défaut
    c'est quoi e.keyCode ?

  4. #4
    Expert éminent sénior
    Avatar de Auteur
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    7 650
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 7 650
    Points : 11 141
    Points
    11 141
    Par défaut
    Citation Envoyé par deborah95 Voir le message
    c'est quoi e.keyCode ?
    utilise keyCode au lieu de which

    un exemple tout simple ci-dessous (fonctionne sous IE et FF) :
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
     
    <html>
    <head>
    <title></title>
     
    <script type="text/javascript">
    <!--
    function touchesSpeciales(ev)
    {
      var alt = ev.altKey;
      var shift = ev.shiftKey;
      var ctrl = ev.ctrlKey;
      var touche = ev.keyCode;
      var codeHTML="";
     
      if (shift)
         codeHTML += "shift + ";
      if (ctrl)
         codeHTML +="ctrl + ";
      if (alt)
         codeHTML += "alt + ";
      //if (touche>31)
      {
       codeHTML += touche+"<br>";;
       document.getElementById("out").innerHTML += codeHTML;
      }
    }
    //-->
    </script>
     
    </head>
     
    <body onkeydown="touchesSpeciales(event)">
     
    Appuyez sur une touche pour connaître son code ASCII :
    <div id="out"></div>
     
    </body>
     
    </html>

Discussions similaires

  1. help!! problème de compatibilité ascendante
    Par valfredr dans le forum XMLRAD
    Réponses: 5
    Dernier message: 16/06/2003, 16h15
  2. [7RC3] Compatibilité avec les anciennes versions ...
    Par Sylvain Leray dans le forum XMLRAD
    Réponses: 3
    Dernier message: 15/05/2003, 16h46
  3. Compatibilité Visibroker 4.5 C++ Builder
    Par manuel dans le forum CORBA
    Réponses: 4
    Dernier message: 15/07/2002, 21h57
  4. compatibilité des librairies directX8
    Par Freakazoid dans le forum DirectX
    Réponses: 3
    Dernier message: 23/05/2002, 21h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo