限制文本框只能录入数字,小数点,减号,要求录入其它字符时无反应,用javascript如何实现,请写出详细代码

解决方案 »

  1.   


      <html>   
      <head>   
      <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
      <meta   name="GENERATOR"   content="Microsoft   FrontPage   4.0">   
      <meta   name="ProgId"   content="FrontPage.Editor.Document">   
      <title>请输入下列范围的字符</title>   
      </head>   
      <body>   
      请输入下列范围的字符:a-z、A-Z、1-9、.、*、_   
      <INPUT   type="text"   id=text1   name=text1   onblur="if(this.value.match(/[-]{0,1}[/d]*.[/d]*/)!=this.value){alert('请输入合法字符!   
      ');this.focus();}">   
      </body>   
      </html>