Tema: validar
Ver Mensaje Individual
Antiguo 11-abr-2005, 17:09   #7 (permalink)
xknown
xknown está en el buen camino
 
Avatar de xknown
 
Fecha de Ingreso: diciembre-2004
Ubicación: Cusco - Perú
Mensajes: 2.249
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
xknown está desconectado   Responder Citando