W3 因

发布于 2024-10-01 05:41:51 字数 790 浏览 3 评论 0原文

我的应用程序运行良好,但我希望能够在 W3 上完全验证它。

我的问题很简单。我正在使用 Bing JS API 将 Bing 地图附加到 Div 标签。在该 Div 标记中,我有一个 元素,如果禁用 javascript,该元素会调用 MultiMap 静态地图提供程序。我选择这样做的原因是,如果我不打算实际使用 MultiMap API,我就不想调用它。

有没有其他方法可以做到这一点,以便我可以成为 W3 HTML5 有效的?

<div id='bingMap' class="largeMap">
    <noscript>
        <img src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&amp;width=550&amp;height=400&amp;lat_1=51.18468&amp;lon_1=-114.497999&amp;lat_2=51.169858&amp;lon_2=-114.32549&amp;lat_3=51.083277&amp;lon_3=-114.203964&amp;lat_4=51.063097&amp;lon_4=-114.092031&amp;lat_5=50.939664&amp;lon_5=-113.973568" />
    </noscript>
</div>

I've got my application working great, however I'd LOVE to be able to have it validate completely on W3.

My problem is quite simple. I'm using the Bing JS API to attach a Bing Map to a Div tag. Within that Div tag, I have a <noscript> element that calls the MultiMap static map provider IF javascript is disabled. The reason I've chosen to do it this way is because I don't want to call the MultiMap API if I'm not going to actually use it.

Is there an alternative way to do this so that I can be W3 HTML5 valid?

<div id='bingMap' class="largeMap">
    <noscript>
        <img src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&width=550&height=400&lat_1=51.18468&lon_1=-114.497999&lat_2=51.169858&lon_2=-114.32549&lat_3=51.083277&lon_3=-114.203964&lat_4=51.063097&lon_4=-114.092031&lat_5=50.939664&lon_5=-113.973568" />
    </noscript>
</div>

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

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

发布评论

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

评论(4

祁梦 2024-10-08 05:41:51

这也许是:

<html>
<body>
  <script type="text/javascript">
    document.write("<" + "!--");
  </script>
  <p>This will be commented out if scripting is supported.</p>
  <script type="text/javascript">
    document.write("-" + "->");
  </script>
</body>
</html>

This perhaps:

<html>
<body>
  <script type="text/javascript">
    document.write("<" + "!--");
  </script>
  <p>This will be commented out if scripting is supported.</p>
  <script type="text/javascript">
    document.write("-" + "->");
  </script>
</body>
</html>
亢潮 2024-10-08 05:41:51

包装到 div、p 或其他块元素中。 只允许将块元素作为直接子元素。

<div id='bingMap' class="largeMap">
    <noscript>
        <div>
            <img src="....." />
        </div>
    </noscript>
</div>

wrap the <img/> into a div, p or another block-element. <noscript> is only allowed to have block-elements as direct child.

<div id='bingMap' class="largeMap">
    <noscript>
        <div>
            <img src="....." />
        </div>
    </noscript>
</div>
爱,才寂寞 2024-10-08 05:41:51

我建议删除 xmlns 以防止它将您的代码解释为 XHTML5(而不是 HTML5),因为 XHTML5 只是 HTML5 的更严格版本,不允许使用许多功能。 HTML5仍然支持XHTML风格的标签,所以没有损失。

像下面这样的东西会起作用:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>title</title>
  </head>
  <body>
    <div id="bingMap" class="largeMap">
      <noscript>
        <img alt="" src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&width=550&height=400&lat_1=51.18468&lon_1=-114.497999&lat_2=51.169858&lon_2=-114.32549&lat_3=51.083277&lon_3=-114.203964&lat_4=51.063097&lon_4=-114.092031&lat_5=50.939664&lon_5=-113.973568" />
      </noscript>
    </div>
  </body>
</html>

I would suggest taking out the xmlns in order to prevent it from interpreting your code as XHTML5 (as opposed to HTML5) as XHTML5 is just a stricter version of HTML5 disallowing many features. HTML5 still supports XHTML-style tags, so no loss.

Something like the following would work:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>title</title>
  </head>
  <body>
    <div id="bingMap" class="largeMap">
      <noscript>
        <img alt="" src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&width=550&height=400&lat_1=51.18468&lon_1=-114.497999&lat_2=51.169858&lon_2=-114.32549&lat_3=51.083277&lon_3=-114.203964&lat_4=51.063097&lon_4=-114.092031&lat_5=50.939664&lon_5=-113.973568" />
      </noscript>
    </div>
  </body>
</html>
○愚か者の日 2024-10-08 05:41:51

以下内容在 http://validator.w3.org/check 上对我进行了验证

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>title</title>
    <meta http-equiv="content-type" 
        content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body>

<div id='bingMap' class="largeMap">
    <noscript>
      <div>
        <img alt="" src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&width=550&height=400&lat_1=51.18468&lon_1=-114.497999&lat_2=51.169858&lon_2=-114.32549&lat_3=51.083277&lon_3=-114.203964&lat_4=51.063097&lon_4=-114.092031&lat_5=50.939664&lon_5=-113.973568" />
      </div>
    </noscript>
</div>

</body>
</html>

The following validates for me at http://validator.w3.org/check

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC
  "-//W3C//DTD XHTML 1.1//EN"
  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>title</title>
    <meta http-equiv="content-type" 
        content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
</head>
<body>

<div id='bingMap' class="largeMap">
    <noscript>
      <div>
        <img alt="" src="http://developer.multimap.com/API/map/1.2/xxxxxxxxxxxxxxx?zoomFactor=11&width=550&height=400&lat_1=51.18468&lon_1=-114.497999&lat_2=51.169858&lon_2=-114.32549&lat_3=51.083277&lon_3=-114.203964&lat_4=51.063097&lon_4=-114.092031&lat_5=50.939664&lon_5=-113.973568" />
      </div>
    </noscript>
</div>

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