我在我的HTML表单中有一个文本框,并且我想限制用户在它和0之间输入一个十六进制值。我该怎么做?如何限制一个文本框只输入一个十六进制值
我的HTML文本框代码:
<div class="input-resp-hpux-vbus"><span><input class="textbox" id="vbus-id" name="vbus-id" type="text" size="5" maxlength="3" value="<?php if(isset($_POST['vbus-id'])) { echo htmlentities ($_POST['vbus-id']); }?>" /></span></div>
试试这个正则表达式'(0-9 [AF])+' – Praveen
[JavaScript正则表达式 - 匹配一系列十六进制数字]的可能重复(http://stackoverflow.com/questions/2156746/javascript-regular -expressions-match-a-series-of-hexadecimal-numbers) – Praveen