submit
如果通过 Chrome v19 中的 javascript 提交,我的按钮的值将丢失。它适用于 IE8、IE9 和 FF12。我有以下显示问题的页面:
<html>
<head>
<script type="text/javascript">
function submitorder()
{
document.openord.TYPE.value='Submitted using javascript';
document.openord.submit();
}
</script>
</head>
<body>
<pre>
The contents of $_REQUEST are:
<?php var_dump($_REQUEST); ?>
</pre>
<form method="post" action="showParms.php" name="openord">
<input type="hidden" name="TYPE" value="Submitted the regular ol' way">
<input type="hidden" name="NAME" value="Frederick Q. Larson">
<input type="submit" name="TASK" value="Submit with Javascript" onclick='submitorder();'>
<input type="submit" name="TASK" value="Normal Submit">
</form>
</body>
</html>
单击“正常提交”,您将看到TASK
如下值:
The contents of $_REQUEST are:
array(3) {
["TYPE"]=>
string(29) "Submitted the regular ol' way"
["NAME"]=>
string(19) "Frederick Q. Larson"
["TASK"]=>
string(13) "Normal Submit"
}
“使用 Javascript 提交”按钮并非如此:
The contents of $_REQUEST are:
array(2) {
["TYPE"]=>
string(26) "Submitted using javascript"
["NAME"]=>
string(19) "Frederick Q. Larson"
}
在 IE 和 FF 中,单击“使用 Javascript 提交”时,您会看到:
The contents of $_REQUEST are:
array(3) {
["TYPE"]=>
string(26) "Submitted using javascript"
["NAME"]=>
string(19) "Frederick Q. Larson"
["TASK"]=>
string(22) "Submit with Javascript"
}
知道为什么 Chrome 会遇到这个问题吗?