需要一个根据浏览器的 JavaScript 启用/禁用而起作用的链接

发布于 2024-12-03 12:31:14 字数 2242 浏览 14 评论 0原文

如果禁用了 javascript,我已经使用 style-sheet 和 实现了警报弹出窗口。 弹出窗口有警告消息和“确定”按钮。 在所有浏览器中禁用 javascript 之前,“确定”按钮将不起作用。 当启用 javascript 并且不重新加载页面时

On FF:- 单击“Ok”按钮页面会重新加载

其他浏览器:- 单击“Ok”按钮没有任何反应

我想要我的“Ok”按钮在所有其他浏览器(IE、Opera、Safari、Chrome)中表现得像 FF,我怎样才能实现这一点?

我的代码编辑后如下

<!-- [START] Following code is get runed to show pop-up when javascript is disabled -->
<noscript>
  <div id="javascript_disabled_fade" class="black_overlay" style="display:block;"></div>
    <div id="pagewrap-light-small" style="display:block;">
      <div id="javascript_disabled_popup" class="white_content_javascript_disabled" style="margin-left:-185px;margin-top:-143px;width: 371px;height:287px;padding:0px;">
        <div style="margin:0px;padding:0px;">
          <table align="center" style="text-align:center;width:371px;height:287px; " cellpadding="0" cellspacing="0" border="0"  >
            <tr>
              <td align="center" style="text-align:center;padding-left:2px;height:150px;padding-top:8px;" colspan="2">
                <img style="border: 0px none ;" src="/images/logo-small.png"/><br/>
                <img style="border:none;" src="/images/account_management.png"/>
              </td>
            </tr>
            <tr>
              <td colspan="2" align="center" style="font-weight:bold;font-size:12px;color:#5a5a5a; text-align:center; line-height:18px;" >
                The site makes extensive use of JavaScript.<br/>
                Please enable <span style="color:red;">JavaScript</span> in your browser.
              </td>
            </tr>
            <tr>
            <td valign="top" align="center" style="padding-top:24px;" colspan="2">
          <a href="javascript:void(0)" onclick="window.location.reload();" class="okGreen"></a>
            </td></tr>
          </table>
        </div>
      </div>
    </div>
</noscript>
<!-- [END] Following code is get runed to show pop-up when javascript is disabled -->

I have implemented an Alert pop-up using style-sheet and <noscript> if javascript is disabled.
The pop-up has warning message and Ok button.
Ok button will not work until the javascript is disabled in all the browsers.
When javascript enabled and w/o reloading the page

On FF:- Clicking on Ok button page gets Reload

Other Browsers:- Clicking on Ok button nothing happens

I want my Ok button to behave like FF in all the Other Browsers (IE, Opera, Safari, Chrome), how i can achieve this ?

Edited my code is as follows

<!-- [START] Following code is get runed to show pop-up when javascript is disabled -->
<noscript>
  <div id="javascript_disabled_fade" class="black_overlay" style="display:block;"></div>
    <div id="pagewrap-light-small" style="display:block;">
      <div id="javascript_disabled_popup" class="white_content_javascript_disabled" style="margin-left:-185px;margin-top:-143px;width: 371px;height:287px;padding:0px;">
        <div style="margin:0px;padding:0px;">
          <table align="center" style="text-align:center;width:371px;height:287px; " cellpadding="0" cellspacing="0" border="0"  >
            <tr>
              <td align="center" style="text-align:center;padding-left:2px;height:150px;padding-top:8px;" colspan="2">
                <img style="border: 0px none ;" src="/images/logo-small.png"/><br/>
                <img style="border:none;" src="/images/account_management.png"/>
              </td>
            </tr>
            <tr>
              <td colspan="2" align="center" style="font-weight:bold;font-size:12px;color:#5a5a5a; text-align:center; line-height:18px;" >
                The site makes extensive use of JavaScript.<br/>
                Please enable <span style="color:red;">JavaScript</span> in your browser.
              </td>
            </tr>
            <tr>
            <td valign="top" align="center" style="padding-top:24px;" colspan="2">
          <a href="javascript:void(0)" onclick="window.location.reload();" class="okGreen"></a>
            </td></tr>
          </table>
        </div>
      </div>
    </div>
</noscript>
<!-- [END] Following code is get runed to show pop-up when javascript is disabled -->

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

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

发布评论

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

评论(2

静若繁花 2024-12-10 12:31:14

这在我的 IE8 和 Chrome13 测试中有效

<html>
  <head>
  <noscript>
    Your browser do not support javascript or javascript is currently disabled.<br/>
    Enable javascript and press button <Reload Page><br/>
    <form name="noscript_reload" method="GET">
      <input type="submit" value="Reload Page"/>
    </form>
  </noscript>
  </head>
<body>
  BODY TEXT
</body>
</html>

This works in my tests in IE8 and Chrome13

<html>
  <head>
  <noscript>
    Your browser do not support javascript or javascript is currently disabled.<br/>
    Enable javascript and press button <Reload Page><br/>
    <form name="noscript_reload" method="GET">
      <input type="submit" value="Reload Page"/>
    </form>
  </noscript>
  </head>
<body>
  BODY TEXT
</body>
</html>
人生百味 2024-12-10 12:31:14

我认为在没有 JavaScript 的情况下让它“重新加载”的唯一方法是让你的“确定”按钮成为一个锚标记,其中的 href 指向同一页面。

I think the only way to get it to "reload" without javascript would be to make your OK button be an anchor tag with an href pointing to the same page.

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