我在 Firefox 5 中发现了一个奇怪的错误(我现在无法访问 4)。但是,我认为它可能在 Firefox 4 中工作,因为我刚买了一台新电脑,而且我不记得以前见过这个错误。
我有几个选择框。所选值基于会话值,该值可以通过模式窗口中的某些选择进行更改。当我关闭模式窗口并刷新页面时,它不会将选择框更新为正确选择的值,而是保留在页面首次加载时最初选择的值。非常奇怪的是,当我查看 Firebug 中的代码时,它显示了正确选择的值,但这不是选择框显示为选中的值!我还运行了 javascript,selectedIndex 是我在 Firebug 中看到的并且正确的,但它不是我看到的选择。
如果我进行硬刷新,我将看到选择的正确值。我尝试将 selectedIndex 设置为 selectedIndex 或其他值,但这仅适用于硬刷新 - 即使我知道代码正在运行,因为警报正在运行。这段代码在其他浏览器中运行良好。有谁知道有什么解决方法吗?
<select id="sportid" name="sportid">
<option value="all">All</option>
<option selected="selected" value="8">3 on 3 Ice Hockey</option>
<option value="1">Basketball</option>
<option value="4">Billiards</option>
<option value="6">Broomball</option>
<option value="7">Dodgeball</option>
<option value="10">Field Hockey</option>
</select>
因此,尽管应该选择 3 on 3 Ice Hockey,并且 html 表示已选择,但我看到了篮球——这是之前的选择。
谢谢!
余烬
I've found a strange bug in Firefox 5 (I don't have access to 4 right now). But, I think it was probably working in Firefox 4 because I just got a new computer and I don't remember seeing this error before.
I have a couple of select boxes. The selected value is based on a session value that can change by some selects in a modal window. When I close the modal window and refresh the page, instead of updating the select boxes to the correctly selected value, it stays on the value originally chosen when the page first loaded. What's very strange is that when I look at the code in Firebug it shows the correctly selected value, but that is NOT the value the select box shows as selected! I've also run javascript and the selectedIndex is what I see in Firebug and correct, but it is NOT what I see selected.
If I do a hard refresh, I will see the correct value selected. I've tried to set the selectedIndex to the selectedIndex or some other value, but this will ONLY work on a hard refresh--even though I know the code is running because the alerts run. This code works fine in other browsers. Does anyone know of any workarounds?
<select id="sportid" name="sportid">
<option value="all">All</option>
<option selected="selected" value="8">3 on 3 Ice Hockey</option>
<option value="1">Basketball</option>
<option value="4">Billiards</option>
<option value="6">Broomball</option>
<option value="7">Dodgeball</option>
<option value="10">Field Hockey</option>
</select>
So, Even though 3 on 3 Ice Hockey should be selected, and the html says is selected, I see Basketball--which was the previous selection.
Thanks!
Ember
发布评论
评论(1)
尝试添加 autocomplete="off"
Try to add autocomplete="off"