[ Index ]
 

Code source de Typo3 4.1.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/t3lib/ -> jsfunc.updateform.js (source)

   1  /***************************************************************
   2  *
   3  *  Universal formupdate-function
   4  *
   5  * $Id: jsfunc.updateform.js 196 2004-04-14 09:12:47Z typo3 $
   6  *
   7  *
   8  *
   9  *  Copyright notice
  10  *
  11  *  (c) 1998-2003 Kasper Skaarhoj
  12  *  All rights reserved
  13  *
  14  *  This script is part of the TYPO3 t3lib/ library provided by
  15  *  Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
  16  *
  17  *  Released under GNU/GPL (see license file in tslib/)
  18  *
  19  *  This script is distributed in the hope that it will be useful,
  20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  22  *
  23  *  This copyright notice MUST APPEAR in all copies of this script
  24  ***************************************************************/
  25  
  26  
  27  function updateForm(formname,fieldname,value)    {
  28      if (document[formname] && document[formname][fieldname])    {
  29          var fObj = document[formname][fieldname];
  30          var type=fObj.type;
  31          if (!fObj.type)    {
  32              type="radio";
  33          }
  34          switch(type)    {
  35              case "text":
  36              case "textarea":
  37              case "hidden":
  38              case "password":
  39                  fObj.value = value;
  40              break;
  41              case "checkbox":
  42                  fObj.checked = ((value && value!=0) ? "on":"");
  43              break;
  44              case "select-one":
  45                  var l=fObj.length;
  46                  for (a=0;a<l;a++)    {
  47                      if (fObj.options[a].value == value)    {
  48                          fObj.selectedIndex = a;
  49                      }
  50                  }
  51              break;
  52              case "select-multiple":
  53                  var l=fObj.length;
  54                  for (a=0;a<l;a++)    {
  55                      if (fObj.options[a].value == value)    {
  56                          fObj.options[a].selected = 1;
  57                      }
  58                  }
  59              break;
  60              case "radio":
  61                  var l=fObj.length;
  62                  for (a=0; a<l;a++)    {
  63                      if (fObj[a].value==value)    {
  64                          fObj[a].checked = 1;
  65                      }
  66                  }
  67              break;
  68              default:
  69          }
  70      }
  71  }


Généré le : Sun Nov 25 17:13:16 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics