Firefox 4.0.1 不显示 selected=“selected”

发布于 2024-11-12 14:27:00 字数 1247 浏览 2 评论 0原文

我有一个想要显示的表格。它似乎在除 Firefox 4.0.1 之外的所有浏览器中都能正常工作。

代码如下所示:

<?php $gender = 'Male'; ?>
        <select disabled="disabled" class="input-300 no-border" name="signup_gender" id="signup_gender" tabindex="40">
            <option value="-">Select Gender</option>
            <option value="Female" <?php if($gender == 'Female'){echo 'selected="selected"';} ?> >Female</option>
            <option value="Male" <?php if($gender == 'Male'){echo 'selected="selected"';} ?>>Male</option>
        </select>

现在,在 Firefox 4.0.1 中,该选项仍保留在“选择性别”选项上,但包括 FF3.6 及更低版本在内的所有其他浏览器都会显示所选的正确“男性”选项。

我已经尝试过使用和不使用 disabled="disabled" 部分,所以它与此无关。有其他人遇到过这个问题,或者知道如何解决它吗?

编辑:

问题是我可以查看源代码,它看起来是正确的..它只是不显示...我的意思是我看看它,它看起来像

        <select disabled="disabled" class="input-300 no-border" name="signup_gender" id="signup_gender" tabindex="40">
            <option value="-">Select Gender</option>
            <option value="Female"  >Female</option>
            <option value="Male" selected="selected">Male</option>
        </select>

但仍然没有选择男性

I have a form that I am trying to display. It seems to work fine in all browsers other than Firefox 4.0.1.

The code looks like this:

<?php $gender = 'Male'; ?>
        <select disabled="disabled" class="input-300 no-border" name="signup_gender" id="signup_gender" tabindex="40">
            <option value="-">Select Gender</option>
            <option value="Female" <?php if($gender == 'Female'){echo 'selected="selected"';} ?> >Female</option>
            <option value="Male" <?php if($gender == 'Male'){echo 'selected="selected"';} ?>>Male</option>
        </select>

Now in Firefox 4.0.1 this remains on the option "Select Gender", but every other browser including FF3.6 and lower displays the correct 'Male' option selected.

I have tried this with and without the disabled="disabled" part in there so it's not to do with that. Has anyone else experienced this issue, or know how to fix it?

EDIT:

The thing is that i can view the source code and it looks right.. its just not displaying... i mean i look at it and it looks like

        <select disabled="disabled" class="input-300 no-border" name="signup_gender" id="signup_gender" tabindex="40">
            <option value="-">Select Gender</option>
            <option value="Female"  >Female</option>
            <option value="Male" selected="selected">Male</option>
        </select>

but still isnt selecting Male

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

開玄 2024-11-19 14:27:00

尝试关闭浏览器窗口,然后重新启动页面。我发现 Firefox 中有时选项是“粘性的”;也就是说,即使页面重新加载,它也会保留旧设置。或者,您可以按住 Ctrl 并单击刷新按钮或按 F5 尝试从头开始刷新。

如果您将选项设置为“选择性别”并修复了您的代码,即使它是正确的,这也可能是您的问题。

附带说明一下,如果您只有两个选择,您是否考虑过使用一组单选按钮而不是下拉列表框?更少的点击=更满意的用户。 :)

Try closing your browser window then relaunching the page. I've found in Firefox that sometimes options are "sticky;" that is, it will keep the old setting even on page reloads. Alternatively, you can hold down Ctrl and click the refresh button of press F5 to try to do a refresh-from-scratch.

If you had the option set to Select Gender and fixed your code, even if it's right, that could be your problem.

As a side note, if you have only two choices, have you considered a set of radio buttons instead of a drop-down listbox? Fewer clicks = happier users. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文