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 :

is not a function


Sujet :

JavaScript

  1. #1
    Membre régulier
    Profil pro
    Étudiant
    Inscrit en
    Décembre 2006
    Messages
    177
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Décembre 2006
    Messages : 177
    Points : 106
    Points
    106
    Par défaut is not a function
    Bonjour,

    J'ai une fonction javascript :

    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
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
     
    function action(valeur)
    {
    	alert('valeur vaut :'+valeur);
    	if(valeur=='louer')
    		{
    		document.choix.budget_min.options[0].text='0';
    		document.choix.budget_min.options[0].value='0';
    		document.choix.budget_min.options[1].text='100';
    		document.choix.budget_min.options[1].value='100';
    		document.choix.budget_min.options[2].text='200';
    		document.choix.budget_min.options[2].value='200';
    		document.choix.budget_min.options[3].text='400';
    		document.choix.budget_min.options[3].value='400';
    		document.choix.budget_min.options[4].text='600';
    		document.choix.budget_min.options[4].value='600';
    		document.choix.budget_min.options[5].text='800';
    		document.choix.budget_min.options[5].value='800';
    		document.choix.budget_min.options[6].text='1000';
    		document.choix.budget_min.options[6].value='1000';
    		document.choix.budget_min.options[7].text='1400';
    		document.choix.budget_min.options[7].value='1400';
    		document.choix.budget_min.options[8].text='1800';
    		document.choix.budget_min.options[8].value='1800';
    		document.choix.budget_min.options[9].text='2100';
    		document.choix.budget_min.options[9].value='2100';
    		document.choix.budget_min.options[10].text='2100 et +';
    		document.choix.budget_min.options[10].value='2101';
     
    		document.choix.budget_max.options[0].text='0';
    		document.choix.budget_max.options[0].value='0';
    		document.choix.budget_max.options[1].text='100';
    		document.choix.budget_max.options[1].value='100';
    		document.choix.budget_max.options[2].text='200';
    		document.choix.budget_max.options[2].value='200';
    		document.choix.budget_max.options[3].text='400';
    		document.choix.budget_max.options[3].value='400';
    		document.choix.budget_max.options[4].text='600';
    		document.choix.budget_max.options[4].value='600';
    		document.choix.budget_max.options[5].text='800';
    		document.choix.budget_max.options[5].value='800';
    		document.choix.budget_max.options[6].text='1000';
    		document.choix.budget_max.options[6].value='1000';
    		document.choix.budget_max.options[7].text='1400';
    		document.choix.budget_max.options[7].value='1400';
    		document.choix.budget_max.options[8].text='1800';
    		document.choix.budget_max.options[8].value='1800';
    		document.choix.budget_max.options[9].text='2100';
    		document.choix.budget_max.options[9].value='2100';
    		document.choix.budget_max.options[10].text='2100 et +';
    		document.choix.budget_max.options[10].value='2101';
    		}
     
    	if(valeur=='acheter')
    		{
    		document.choix.budget_min.options[0].text='0';
    		document.choix.budget_min.options[0].value='0';
    		document.choix.budget_min.options[1].text='40000';
    		document.choix.budget_min.options[1].value='40000';
    		document.choix.budget_min.options[2].text='80000';
    		document.choix.budget_min.options[2].value='80000';
    		document.choix.budget_min.options[3].text='100000';
    		document.choix.budget_min.options[3].value='100000';
    		document.choix.budget_min.options[4].text='150000';
    		document.choix.budget_min.options[4].value='150000';
    		document.choix.budget_min.options[5].text='200000';
    		document.choix.budget_min.options[5].value='200000';
    		document.choix.budget_min.options[6].text='300000';
    		document.choix.budget_min.options[6].value='300000';
    		document.choix.budget_min.options[7].text='400000';
    		document.choix.budget_min.options[7].value='400000';
    		document.choix.budget_min.options[8].text='600000';
    		document.choix.budget_min.options[8].value='600000';
    		document.choix.budget_min.options[9].text='800000';
    		document.choix.budget_min.options[9].value='800000';
    		document.choix.budget_min.options[10].text='1000000';
    		document.choix.budget_min.options[10].value='1000000';
    		document.choix.budget_min.options[11].text='1200000';
    		document.choix.budget_min.options[11].value='1200000';
    		document.choix.budget_min.options[12].text='1500000';
    		document.choix.budget_min.options[12].value='1500000';
    		document.choix.budget_min.options[13].text='2000000';
    		document.choix.budget_min.options[13].value='2000000';
    		document.choix.budget_min.options[14].text='2000000 et +';
    		document.choix.budget_min.options[14].value='2000001';
     
    		document.choix.budget_min.options[0].text='0';
    		document.choix.budget_min.options[0].value='0';
    		document.choix.budget_min.options[1].text='40000';
    		document.choix.budget_min.options[1].value='40000';
    		document.choix.budget_min.options[2].text='80000';
    		document.choix.budget_min.options[2].value='80000';
    		document.choix.budget_min.options[3].text='100000';
    		document.choix.budget_min.options[3].value='100000';
    		document.choix.budget_min.options[4].text='150000';
    		document.choix.budget_min.options[4].value='150000';
    		document.choix.budget_min.options[5].text='200000';
    		document.choix.budget_min.options[5].value='200000';
    		document.choix.budget_min.options[6].text='300000';
    		document.choix.budget_min.options[6].value='300000';
    		document.choix.budget_min.options[7].text='400000';
    		document.choix.budget_min.options[7].value='400000';
    		document.choix.budget_min.options[8].text='600000';
    		document.choix.budget_min.options[8].value='600000';
    		document.choix.budget_min.options[9].text='800000';
    		document.choix.budget_min.options[9].value='800000';
    		document.choix.budget_min.options[10].text='1000000';
    		document.choix.budget_min.options[10].value='1000000';
    		document.choix.budget_min.options[11].text='1200000';
    		document.choix.budget_min.options[11].value='1200000';
    		document.choix.budget_min.options[12].text='1500000';
    		document.choix.budget_min.options[12].value='1500000';
    		document.choix.budget_min.options[13].text='2000000';
    		document.choix.budget_min.options[13].value='2000000';
    		document.choix.budget_min.options[14].text='2000000 et +';
    		document.choix.budget_min.options[14].value='2000001';
    		}
    }
    que j'appelle de cette façon :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    <INPUT type="radio" name="transaction" value="acheter" class="INPUT" onChange="action(this.value)" checked>Acheter
        					<INPUT type="radio" name="transaction" value="louer" class="INPUT" onChange="action(this.value)">Louer
    et dans la console javascript il me met :

    action() is not a function

    Quelqu'un a une idée

  2. #2
    Membre expert
    Avatar de FremyCompany
    Profil pro
    Étudiant
    Inscrit en
    Février 2006
    Messages
    2 532
    Détails du profil
    Informations personnelles :
    Âge : 32
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Février 2006
    Messages : 2 532
    Points : 3 239
    Points
    3 239
    Par défaut
    Tu dois avoir une autre erreur dans la console, une erreur de syntaxe celle-la, qui empeche de charger ton script
    Fremy
    Pour vos développements Web et une navigation agréable, le tout gratuit :
    1) IE 8 + IE7Pro (Si vous ne connaissez pas IE7Pro, essayez !)
    2) FF 3 + Web Developper Toolbar + AdBlockPlus + FireBug + GreaseMonkey

  3. #3
    Membre expérimenté
    Avatar de Gruik
    Profil pro
    Développeur Web
    Inscrit en
    Juillet 2003
    Messages
    1 566
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Juillet 2003
    Messages : 1 566
    Points : 1 729
    Points
    1 729
    Par défaut
    Je pense comme Fremy, tu as peut etre d'autres erreurs qui font que cette fonction n'est pas definie
    .. ou alors cette fonction est dans un .js qui n'a pas été inclus

  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 142
    Points
    11 142
    Par défaut
    bonjour,

    quelques remarques sur ton code HTML :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    <INPUT type="radio" name="transaction" value="acheter" class="INPUT" onChange="action(this.value)" checked>Acheter
    <INPUT type="radio" name="transaction" value="louer" class="INPUT" onChange="action(this.value)">Louer
    • écrits en minuscule le nom des balises et de leurs attributs
    • class="INPUT" est inutile.
      Code css : Sélectionner tout - Visualiser dans une fenêtre à part
      1
      2
      3
      4
       
      input{
      .....
      }
      le style s'applique à tous les inputs (tu remarqueras l'abscence du point devant le nom de la classe). Sinon trouve un autre nom pour la classe.
    • si ton bouton radio est initialement coché, il recommandé d'écrire l'attribut checked de cette manière : checked="checked" . Exemple avec ton code :
      Code html : Sélectionner tout - Visualiser dans une fenêtre à part
      1
      2
       
      <input type="radio" name="transaction" value="acheter" onchange="action(this.value)" checked="checked">Acheter

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. XX is not a function
    Par Zakapatul dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 24/04/2007, 16h12
  2. [AJAX] erreur: is not a function avec liste déroulante
    Par dr_octopus74 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 21/04/2007, 13h53
  3. indexOf is not a function : pourquoi
    Par avogadro dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 18/08/2006, 17h50
  4. document.getElementByTagName is not a function ?
    Par krolineeee dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 31/05/2006, 10h41
  5. window.document.forms[0].submit is not a function ?????
    Par michaelbob dans le forum Général JavaScript
    Réponses: 15
    Dernier message: 04/01/2006, 16h08

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