- <html>
- <head>
- <title>Sample Code</title>
- <script type="text/javascript">
- function Check(b)
- {
- var a = /(^[0-9]+[-]*[0-9]+$)/;
- if (a.test(b) == true)
- {
- alert("Match Criteria")
- }
- else
- {
- alert("Please Enter Only Digits & Hyphen.")
- }
- };
- </script>
- </head>
- <body bgcolor=#00ff00 alink=blue vlink=blue>
- <FORM name="windowEvent">
- Number : <input type="text" name="txtnumber" />
- <input type="button" value="Check" name="btnNumber" onClick="Check(txtnumber.value)" />
- </FORM>
- </body>
- </html>
Loading

Join the conversation! Your thoughts help the community grow.