我正在尝试用PHP编写代码,如果检查了某个字段。。。
<input type="checkbox" name="OmitDate" value="true" value="<?php echo htmlspecialchars($OmitDate);?>">
选择"清除"按钮时。。。
<input type="reset" value="Clear">
它不能清除表单中的某些字段
<input type="text" name="Date" size="140" value="<?php echo htmlspecialchars(urldecode($Date));?>">
这可能吗?
PHP不适用于客户端操作。使用Javascript。
即,使用jQuery,您可以执行以下操作:
$('#buttonID').click(function(){
$('#textFieldID').val('');
});
简单的内联javascript可以是:
<button id="clearButton" onclick="document.getElementById('textFieldId').value='';">Clear</button>