Tema: validar
Ver Mensaje Individual
  #7 (permalink)  
Antiguo 11/04/2005, 16:09
Avatar de xknown
xknown
 
Fecha de Ingreso: diciembre-2004
Ubicación: Cusco - Perú
Mensajes: 2.248
Antigüedad: 20 años, 2 meses
Puntos: 7
Pues a mi me funciona perfectamente con Firefox, también lo probé con IE 6. Te envío el ejemplito que tengo:
Código:
<%@ Page Language="C#" %>
<script runat="server">
    void Page_Load(object sender, EventArgs e) {
         if (!Page.IsPostBack)
            textBoxCiudad.Attributes.Add("onkeypress", "return validar(event)");
    }

</script>
<html>
<head>
    <script type="text/javascript">
    function validar(e) {
        tecla = (document.all)?e.keyCode:e.which;
        if (tecla==8) return true;
        patron = /[a-zA-ZÑñ\s]/;
        return patron.test(String.fromCharCode(tecla));
    }
    </script>
</head>
<body>
    <form runat="server">
        <asp:TextBox id="textBoxCiudad" runat="server"></asp:TextBox>
    </form>
</body>
</html>
__________________
Alex Concha
Buayacorp - Programación y Diseño