Ver Mensaje Individual
  #20 (permalink)  
Antiguo 23/07/2009, 09:40
piano_bar
 
Fecha de Ingreso: julio-2009
Mensajes: 14
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: Nuevo resaltador de código Geishi!

probando......

Código asp:
Ver original
  1. <script>
  2.  
  3. function AbrirConexion()
  4. {
  5.     var Conexion = new ActiveXObject("ADODB.Connection")
  6.     var adOpenKeyset = 1
  7.     var adLockOptimistic = 3
  8.  
  9.     Conexion.open("Provider=Microsoft.Access.OLEDB.4.0;Data Source=\\Inetpub\\wwwroot\\Quiniela\\DBTragaMonedas.mdb")
  10.    
  11.     return Conexion
  12. }
  13.  
  14. function DevolverRecordset(strSQL)
  15. {
  16.     var Rs = new ActiveXObject("ADODB.Recordset")
  17.     var cn = AbrirConexion()
  18.    
  19.     Rs.open(strSQL, cn, 3, 1)
  20.    
  21.     return Rs
  22. }
  23.  
  24. function ExecutarConsulta(strSQL)
  25. {
  26.     var Rs = new ActiveXObject("ADODB.Recordset")
  27.     var cn = AbrirConexion()
  28.    
  29.     Rs.open(strSQL, cn, 3, 1)
  30. }
  31.  
  32.  
  33. function checkValores()
  34. {
  35.     var rta;
  36.    
  37.     rta = true;
  38.     if (!IsNumeric(document.getElementById("serie").value)){
  39.         alert("los valores a ingresar deben ser numericos");
  40.         rta = false;
  41.         }
  42.    
  43.     return rta;
  44. }
  45.  
  46. function IsNumeric(sText)
  47. {
  48.    var ValidChars = "0123456789.";
  49.    var IsNumber=true;
  50.    var Char;
  51.  
  52.  
  53.    for (i = 0; i < sText.length && IsNumber == true; i++)
  54.       {
  55.       Char = sText.charAt(i);
  56.       if (ValidChars.indexOf(Char) == -1)
  57.          {
  58.          IsNumber = false;
  59.          }
  60.       }
  61.    return IsNumber;
  62. }
  63.  
  64. function guardarConfiguracion()
  65. {
  66.     if (checkValores())
  67.     {
  68.         //guardo los valores en la tabla
  69.         var sql;
  70.        
  71.         sql = 'UPDATE CONFIGURACION SET '
  72.         sql += 'Serie = ' + document.getElementById("serie").value + ', ';
  73.         sql += 'Ganadores = ' + document.getElementById("ganadores").value + ', ';
  74.         sql += 'Bonus = ' + document.getElementById("bonus").value;
  75.         sql += ' WHERE ID = 1'
  76.        
  77.         ExecutarConsulta(sql)
  78.     }
  79. }
  80.  
  81. function cargarConfiguracion()
  82. {
  83.     var rs;
  84.     var sql;
  85.    
  86.     sql = 'SELECT * FROM CONFIGURACION WHERE ID = 1'
  87.     rs = DevolverRecordset(sql)
  88.     document.getElementById("serie").value = rs('Serie');
  89.     document.getElementById("ganadores").value = rs('Ganadores');
  90.     document.getElementById("bonus").value = rs('Bonus');
  91. }
  92. </script>