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 :

les evenements javascript


Sujet :

JavaScript

  1. #1
    Nouveau candidat au Club
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    1
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 1
    Par défaut les evenements javascript
    Bonjour,

    Je voudrai saisir du texte après un double clic et l'enregistrer dans mon tableau généré grâce a SQL
    comment fait on pour que après un double clic sur une case du tableau il affiche dans cette case une zone de texte que je peux modifier et enregistrer ? voici un bout de mon code :

    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
    }        
    				if($val=='projet') 	{//	$ls = $rdfReporting->getAbout('urn:steria:reporting:plateforme:'.$item['plateforme_id'].':projet');
    // $ls = $rdfReporting->getAbout('urn:steria:reporting:plateforme:'.$item['plateforme_id'].':projet');
    $ls=array();
     
    		  // $dbsql 	= "select * from PROJET,PLATEFORME  WHERE PROJET.ACTIF=1 AND PROJET.ID_PLATEFORME=PLATEFORME.ID_PLATEFORME order by PLATEFORME.ID_PLATEFORME asc";
     
    		  $sql="select * from PLATEFORME WHERE ID_PLATEFORME=2";     
          $query = @sqlite_query(Steria::$database, $sql,SQLITE_ASSOC ,$error);     
     
          ?>
     
    <div >
    	<fieldset>
     
    	<table>
    	<tr><th>Nom du projet</th><th>PER réel</th><th>FV Réel</th><th>MEP</th><th>VSR</th><th>Commentaires</th></tr>
    <?php
    while ($fetcha = sqlite_fetch_array($query,SQLITE_ASSOC )){
     
     
            $variable=$item['plateforme_id'];
    $dbsql  = "select * from PROJET,PLATEFORME  WHERE PROJET.ACTIF=1 AND PROJET.ID_PLATEFORME=PLATEFORME.ID_PLATEFORME AND PROJET.ID_PLATEFORME='$variable'";
    $dbquery = @sqlite_query(Steria::$database, $dbsql,SQLITE_ASSOC ,$error);
    while ($fetch = sqlite_fetch_array($dbquery,SQLITE_ASSOC )){// $list[$fetch['ID_PROJET']] = $fetch['NOM_PROJET'];
     
     
          //$list[$fetch['NOM_PROJET']] = $fetch['CATEGORIE'];
        $list=array();
                            $class = ($class=='rowcol1') ? 'rowcol2' : 'rowcol1' ;
          
                    //      echo "<tr class=\"$class\">";
     
    //echo "<tr  class=\"$class\" onDblClick=\"window.alert('FORBIDDEN !!')\" onMouseOut=\"this.style.backgroundColor=''\">";
    //echo "<tr  class=\"$class\" onDblClick=\"<input type=\"text\" size=\"10\" name=\"$class\" >";
     
    echo "<tr  class=\"$class\" onDblClick=\"<input type=\"text\" size=\"10\" name=\"$class\" >" ;
                    //      "<input type=\"button\" value=\"$inputName\" oncliCk=\"javascript: document.manager.mngAction.value='$actionName'; document.manager.submit();\" >";
                            echo "<td>".@$fetch['PROJET.NOM_PROJET']."</td>";                       
                    //         echo "<td>"."<input type=\"text\" size=\"10\" name=\"$class\" >"."</td>";         
            echo "<td>".$fetch['PROJET.PER_REEL']."</td>";
    //      $moda=$fetch['PROJET.PER_REEL'];
                    echo "<td>".$fetch['PROJET.FV_REEL']."</td>";           
            //      echo "<th><a href='$moda'>$moda</a></th>";      
    //$modb=$fetch['PROJET.FV_REEL'];
            //      echo "<th><a href='$modb'>$modb</a></th>";              
                            echo "<td>".$fetch['PROJET.MEP']."</td>";
    //      $modc=$fetch['PROJET.MEP'];
            //      echo "<th><a href='$modc'>$modc</a></th>";                      
                            echo "<td>".$fetch['PROJET.VSR']."</td>";
    //      $modD=$fetch['PROJET.VSR'];
    //              echo "<th><a href='$modD'>$modD</a></th>";
                                    echo "<td>".$fetch['PROJET.COMMENTAIRE']."</td>";
    //$modE=$fetch['PROJET.COMMENTAIRE'];
    //              echo "<th><a href='$modE'>$modE</a></th>";                      
     
                            echo "</tr>";   
                            
    }
    }
     
            ?>
        </table>
    	</fieldset>
    </div>
     
     
    	<?php	
     
        $dbsql=array(array("","submit","","ENREGISTRER SAISIE"));
     
     echo"<FORM ACTION=\"doc_planification.php\"METHOD=\"POST\">\n";
      //$test=array($dbsql);        
      foreach($dbsql as $zone){
     
    echo "$zone[0]<INPUT TYPE=\"$zone[1]\"
      NAME=\"$zone[2]\" VALUE=\"$zone[3]\"><BR>\n";
     
      }
    echo"</FORM>";
    }

  2. #2
    Rédacteur/Modérateur

    Avatar de SpaceFrog
    Homme Profil pro
    Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Inscrit en
    Mars 2002
    Messages
    39 658
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 75
    Localisation : Royaume-Uni

    Informations professionnelles :
    Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Bidouilleur SharePoint
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2002
    Messages : 39 658
    Billets dans le blog
    1
    Par défaut
    tiens, en fait j'ai un vieux code en stock qui faisait ça sur le simple click, je l'ai modifié pour qu'il fasse le double click ...
    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
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
     
    <html>
    <head>
     
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
     
    <title>Nouvelle page 1</title>
    <style type='text/css'>
    td,#saisie { border:solid 1px black;
         			width:100px;
         			font-family:verdana;
         			font-size:12px;
         			line-height:20px;
         			}
    #saisie {color:red;}
     
     
     
    html body {margin:0;}
     
         </style>
     
    <script type='text/javascript'>
     var currentCell
    function edit(Obj){
      currentCell=Obj; 
      var editbox=document.getElementById('saisie')
      editbox.style.top=currentCell.offsetTop+'px';
      editbox.style.left=currentCell.offsetLeft+'px';
      editbox.style.width=currentCell.offsetWidth+'px';
      editbox.style.height=currentCell.offsetHeight+'px';
      editbox.style.fontSize=currentCell.style.fontSize;
      editbox.style.display='';
      if (!document.all){editbox.style.paddingTop='4px'};
      editbox.value=(currentCell.innerHTML!="&nbsp;")?currentCell.innerHTML.replace:'';
      editbox.focus();
      editbox.value=editbox.value
      }
     
     
    function editSelect(Obj1){
      editsel.style.width=currentCell.offsetWidth+'px';
      editsel.style.height=currentCell.offsetHeight+'px';
      var LesOptions=Obj1.getAttribute("ArrayOpt").split(';');
      while(editsel.options.length>1){editsel.removeChild(editsel.options[editsel.options.length-1])}
      editsel.style.top=currentCell.offsetTop+'px';
      editsel.style.left=currentCell.offsetLeft+'px';
      editsel.style.fontSize=currentCell.style.fontSize;
      editsel.style.visibility="visible";
     
      for(i=0;LesOptions[i];i++){
          var newOpt=document.createElement('option');
          newOpt.value=LesOptions[i];
          newOpt.innerHTML=LesOptions[i];
          if(newOpt.innerHTML==currentCell.innerHTML){newOpt.selected='selected';}
          editsel.appendChild(newOpt);
          }
       editsel.focus();   
      }  
     
    function copyValue(Box){
     
    TransValue="";
    switch(Box.id){
      case "saisie" :   TransValue=(Box.value.length>0)?Box.value:"&nbsp;";
    						Box.value=""
    						Box.style.display='none';
    						break;
      case "MySel":     TransValue=(Box.options.selectedIndex==-1)?"&nbsp;":Box.options[Box.selectedIndex].value;
    						Box.style.top=0;
    						Box.style.left=0;
    						Box.style.visibility='hidden';	
    						break;
    						}
    currentCell.innerHTML=TransValue;
    }
     
     
    function Myinit(){
        var TabTr=document.getElementsByTagName('tr');
     
        for(i=0;TabTr[i];i++){
              var TabTd=TabTr[i].getElementsByTagName('td');
    	       for(j=0;TabTd[j];j++){ 
    	       				TabTd[j].id="Cell"+i+"_"+j;
    	       				if(j==3){TabTd[j].ondblclick=function(){currentCell=this;
    	       															editSelect(this)};
    	       				                                      }
    	       				else{TabTd[j].ondblclick=function(){edit(this)}}
    				          }
       }
    editsel=document.getElementById('MySel');				          
     }     
    window.onResize=function(){alert('coucou');}
     </script>    
     
    </head>
     
    <body onload="Myinit()" >
    <table >
    	<tr>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td ArrayOpt="S;E;L">&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    	</tr>	
    	<tr>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td ArrayOpt="Bonjour;Aurevoir;coucou; salut">&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    	</tr>				
    	<tr>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td ArrayOpt="Banane;Oranges;Kiwi;fraises">&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    	</tr>				
    	<tr>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td ArrayOpt="chocolat;vanille;menthe;café;grenadine">&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    	</tr>				
    	<tr>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    			<td ArrayOpt="rouge;vert;bleu;noir;jaune;marron;taupe;violet;blanc;saumon">&nbsp;</td>
    			<td>&nbsp;</td>
    			<td>&nbsp;</td>
    	</tr>				
    	<tr>
    			<td></td>
    			<td></td>
    			<td></td>
    			<td ArrayOpt="Bonjour;Aurevoir;coucou; salut"></td>
    			<td></td>
    			<td></td>
    	</tr>		
    </table>
     
    <input type='text'	style='position:absolute;display:none;top:0;left:0;width:150px;' id='saisie' onblur="copyValue(this)" value=''/>
    <select id="MySel" name="hello" style='position:absolute;visibility:hidden;top:0;left:0;width:150px;' onblur="copyValue(this)" >
    <option value="&nbsp;">-selectionnez</option>
    </select>			
     
    </body>
    Ma page Developpez - Mon Blog Developpez
    Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
    Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
    Votre post est résolu ? Alors n'oubliez pas le Tag

    Venez sur le Chat de Développez !

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

Discussions similaires

  1. masquer un champs mais garder les evenements ?
    Par Pymm dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 21/07/2005, 12h33
  2. question sur les attributs javascript
    Par PAYASS59 dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 20/04/2005, 13h34
  3. [VB.NET] Les évènements ne marchent pas
    Par Dnx dans le forum ASP.NET
    Réponses: 6
    Dernier message: 28/01/2005, 12h54
  4. Ecouter les evenements clavier et souris
    Par init dans le forum Applications et environnements graphiques
    Réponses: 2
    Dernier message: 24/11/2004, 20h02

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