我想知道是否有一种方法可以调整此代码,以便在单击提交按钮时它会消失,但输入框会保留。
<script type="text/javascript">
var Text = 'hello';
function setInput(button) {
var buttonVal = button.name,
textbox = document.getElementById('input_' + buttonVal);
textbox.value = Text ;
}
</script>
<html>
<input class='input' id="input_a1" name="a1" value="<?php {echo $a1;} ?>">
<input type='submit' name='a1' value='x' onclick='setInput(this); return false;'>
</html>