Comunidad de diseño web y desarrollo en internet online

Problema al llamar funcion en javascript desde html

Citar            
MensajeEscrito el 23 Ene 2009 01:33 pm
Tengo el siguiente formulario que hace el llamado a la funcion validar, soy nuevo en ajax, me marca error diciendo se requiere un objeto:

Código :

function formulario($idioma_,$error){
   include($idioma_);
   echo"<script src='java1.js'></script>";
   //print"<form method='post' action='?mod=mod_usua'>"
   print"<form >"
   ."<table width='241' border='0' align='center'>"
   ."<tr><td colspan='2'>".$BIEVENIDO_USU."</td>"
   ."</tr><tr>"
   ."<td width='72'>".$USUA."</td>"
   ."<td width='159'><input type='text' name='txtusu' /></td>"
   ."</tr><tr>"
   ."<td>".$CONT."</td>"
   ."<td><input type='password' name='txtcon' /></td>"
   ."</tr><tr>"         //en esta parte llamo la funcion validar   
   ."<td><input type='button'  onclick='validar()' value=".$BOTON_ENVIAR."></td>"
   ."<td><input type='reset' name='Submit2' value=".$BOTON_LIMPIAR."></td>"
   ."</tr><tr>"
   ."<td colspan='2'>".$error."</td>"
   ."</tr>"
   ."</table>"
   ."</form>";
} 
mi codigo en javascript es el siguiente cual esmi error¿?

Código :

function nuevoAjax(){
   var xmlhttp=false;
    try {
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
       try {
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (E) {
          xmlhttp = false;
       }
     }

   if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
       xmlhttp = new XMLHttpRequest();
   }
   return xmlhttp;
}
function validar(){
   var  contenedor;
   contenedor = document.getElementById('contenedor');
   t1 = document.getElementById('txtusu').value;
   t2 = document.getElementById('txtcon').value;
   ajax=nuevoAjax();
   ajax.open("GET", "?mod=mod_usua&&t1="+t1+"&&t2="+t2+"opcion=si",true);
   ajax.onreadystatechange=function() {
      if (ajax.readyState==4) {
      contenedor.innerHTML = ajax.responseText
       }
   }
   ajax.send(null)
}

gracias por su ayuda

Por markant0n

25 de clabLevel



 

Comitan de Dominguez, Chiapas

msie
Citar            
MensajeEscrito el 23 Ene 2009 08:11 pm
ha primera vista noto un error al llamar a los valores, llamas a los campos de texto por getElementById y ninguno de los dos tienen id definido, tienen name.

Por gparis

112 de clabLevel



 

Uruguay

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.