2011-10-15 16 views
1

我發現這是一個錯誤或不......那麼其他的瀏覽器,如Chrome和Opera可以如何使用jQuery重置Firefox頁面刷新中的計數器編號?

轉到重置計數器的數字,但Firefox不復位......到http://bksn.mx/opequimar/renta_descripcion.html

有一然後刷新頁面(F5),你會看到「3 de 3」,再試一次,你會看到使用Firefox的「5 de 3」

第一個數字是計數器,最後一個數字是size();每個縮略圖div。

還有數計數器的腳本:

$("a.prevarrow1").click("click", function() { 
    var qInput = $(this).parents(".quantityInput"); 
    var qText = qInput.find(".quantityText"); 
    var qValue = parseInt((qText.val())? qText.val() : 0); 
    qText.val(Math.max(qValue - 1, (qInput.attr("min"))? qInput.attr("min") : -0xffff)); 
}); 

$("a.nextarrow1").click("click", function() { 
    var qInput = $(this).parents(".quantityInput"); 
    var qText = qInput.find(".quantityText"); 
    var qValue = parseInt((qText.val())? qText.val() : 0); 
    qText.val(Math.min(qValue + 1, (qInput.attr("max"))? qInput.attr("max") : 0xffff)); 
}); 

輸出的HTML:

<div class="quantityInput" min="0" max="64"> 
<p>Pags. &nbsp; 
    <input type="text" disabled="disabled" class="quantityText" value="1" /> 
    de &nbsp;<span></span></p> 
<div class="absolute"> 
    <a class="prev prevarrow1"></a> 

<a class="next nextarrow1"></a> 
    </div> 
</div> 

如果是不可能的,我接受從你的新腳本。 在此先感謝!

回答

1

問題是頁碼存儲在文本框中。 Firefox,IE和「瀏覽器返回到Netscape 1(幾乎肯定是NCSA Mosaic)」according to Brendan Eich在重新加載時恢復保存的表單數據,但不能在shift-reload上進行恢復。基於Webkit的瀏覽器在這裏確實是不兼容的。

解決方法是避免使用文本框來顯示數字(將其更改爲< span>,使用jQuery的.text()更改範圍的值),或者讀取輸入的負載值並適當地更新頁面的狀態(滾動縮略圖到指定的頁碼)。

+0

謝謝!我不知道這個問題 – Ivan

相關問題