我有JS的这部分代码在Chrome中无法正常工作,但在IE工作的问题。为什么document.getElementById隐藏输入在IE中可用但不是Chrome?
这是我的javascript代码:
function submitformWithPage(xpage)
{
document.getElementById('itempage').value = xpage;
alert(xpage);
document.searchForm.submit();
}
,这是我的html代码
<form name="searchForm" action="search.php" method="get">
<input type="text" name="search" value="<?php if(isset($_GET['search'])) { echo $_GET['search']; } ?>"/>
<input type="hidden" name="parameter" value="test" />
<input id="item" type="hidden" name="itempage" value="1" />
<input type="hidden" name="pageBigForward" value="10" />
<input type="hidden" name="pageSmallForward" value="1" />
<button style="" onclick="javascript: submitform()">Search</button>
</form>
我通过使用此代码提交表单,它工作在IE,但不是在Chorme。
<button style="" onclick="javascript: submitformWithPage(3);">3</button>
我迷失在如何解决这个问题。
谁能帮助我?
在此先感谢。