Foros del Web » Programando para Internet » Javascript »

ayuda con script

Estas en el tema de ayuda con script en el foro de Javascript en Foros del Web. tengo el siguiente codigo en mi pagina @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código HTML: Ver original <&# 37 ;@page contentType = "text/html" pageEncoding = "UTF-8" %> <!DOCTYPE HTML ...
  #1 (permalink)  
Antiguo 16/02/2011, 17:26
Avatar de valdo_kof  
Fecha de Ingreso: noviembre-2009
Ubicación: San Juan del Rio, Qro
Mensajes: 192
Antigüedad: 14 años, 6 meses
Puntos: 16
ayuda con script

tengo el siguiente codigo en mi pagina

Código HTML:
Ver original
  1. <&#37;@page contentType="text/html" pageEncoding="UTF-8"%>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  3.   "http://www.w3.org/TR/html4/loose.dtd">
  4.  
  5.     <head>
  6.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  7.         <title>JSP Page</title>
  8.         <link rel="stylesheet" href="global.css" type="text/css" media="all" />
  9. <script src="mootools.js" type="text/javascript"></script>
  10. <link rel="stylesheet" href="sexyalertbox.css" type="text/css" media="all" />
  11. <script src="sexyalertbox.packed.js" type="text/javascript"></script>
  12. <script type="text/javascript">
  13.    
  14. function enviar(){
  15. var item=document.forms['form1'].item_no.value;
  16. location.href="imp_et.jsp?item="+item;
  17. }
  18.  
  19.  
  20. <script type="text/javascript">
  21. function foc(){
  22. document.forms['form1'].item_et.focus();
  23. }
  24. <link rel="stylesheet" type="text/css" href="form.css" media="screen"/>
  25. <link rel="stylesheet" type="text/css" href="code.css" media="screen"/>
  26. <link href="style.css" type="text/css" rel="stylesheet" />
  27. <script type="text/javascript" src="custom-form-elements.js"></script>
  28.         <style type="text/css">
  29. <!--
  30. body,td,th {
  31.     color: #FFFFFF;
  32.     font-weight: bold;
  33. }
  34. -->
  35. <style type="text/css">
  36. <!--
  37. body {
  38.     background-image: url(images/img.jpg);
  39. }
  40. -->
  41.  <script type="text/javascript">
  42.    
  43. function validar(oEvento){
  44. var iAscii;
  45.  
  46.  if (oEvento.keyCode)
  47.          iAscii = oEvento.keyCode;
  48.      else if (oEvento.which)
  49.          iAscii = oEvento.which;
  50.      else
  51.          return false;
  52.   if (iAscii == 13){
  53.     llamar();
  54.    
  55. }
  56. }
  57. function llamar(){
  58.      var item=document.forms['form1'].item_no.value;
  59.      var cadena=document.forms['form1'].item_et.value;
  60.      if (!cadena.equals("")){//lo que quiero hacer es q si doy enter y no he metido nada a mi caja de texto me mande a esta pagina
  61.  location.href="validar_verificacion.jsp?bandera=true&item="+item;
  62.  }
  63. else{// si mi caja de texto no viene vacia me mande a esta pagina
  64.    location.href="validar_verificacion.jsp?bandera=false&item="+item;
  65.  
  66. }
  67.  
  68. }
  69.  
  70.     </head>
  71.     <body onLoad="javascript:foc()">    
  72.  
  73.     <form name="form1" action="">
  74.        
  75.         <table width="200" border="0" align="center">
  76.           <tr>
  77.             <td><img src="images/lector.png" width="210" height="192"></td>
  78.             <td nowrap><label>
  79.               Item:
  80.               <input name="item_et" type="text" class="textInput1" id="item_et" onKeyPress="validar(event)" maxlength="13">  <input name="item_no" type="hidden" id="item_no" value="<%=request.getParameter("item")%>">
  81.             </label></td>
  82.           </tr>
  83.         </table>
  84.            <p align="center"><button type="button" style="border:none; background-color:transparent;" id="btt" alt="Imprimir Etiqueta" onclick="enviar()"><span style="border:none; background-color:transparent;"><img src="images/imp_et.jpg" width="150" height="30"></span></button></p>
  85.       </form>
  86.     </body>
  87. </html>

lo q intento hacer es q cuando ingrese un dato y le de enter me mande llamar mi script validar y dentro de validar me manda llemar mi funcion llamar

no se q este haciendo mal pero no me realiza mi if

alguien tiene idea de que es lo q esta mal xq no me manda a las paginas de me debe de mandar

si alguien me puede ayudar se los agradecere mucho

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:33.