簡體   English   中英

javascript在IE中並非始終有效

[英]javascript doesn't work all the time in IE

在jsp中使用spring表單標簽。

以下是我用於分頁的腳本:

function getNextPage(){
var next = document.getElementById('nextPageID');
next.checked=true;
var buttonName = document.getElementById('refreshbuttonID');
buttonName.click();
}

當用戶單擊視圖中的Next (使用jsp)時, onclick事件我正在調用getNextPage();

<button type="submit" onclick="getNextPage();">Next</button>

我將隱藏復選框設置為true

<td>
     <form:checkbox id="nextPageID" path="nextPage"/>  
     <input type="hidden" value="1" name="_nextPage"/>
</td>

然后在控制器中調用方法以獲取下一個結果並顯示在頁面上。

IE和IE瀏覽器在chrome和firefox中都可以正常工作,有時可以,有時不能。 和頁面會不斷刷新舊數據。它始終在調試模式下運行(即使在IE中也是如此)

It is not hitting the javascript in IE on some occassions 有什么我在功能上缺少的東西或在IE中要做的其他事情嗎? 有什么建議么!

我將根據給定的有限信息做出一個猜測:將您的按鈕更改為使用type="button"

<button type="button" onclick="getNextPage();">Next</button>

...因為如果您在表單中有一個提交按鈕,並且您沒有取消默認行為(您的代碼沒有這樣做),那么除了您的代碼在做什么之外,它還會嘗試提交表單。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM