我有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>
我迷失在如何解決這個問題。
誰能幫助我?
在此先感謝。