元素' a'不能嵌套在元素内部#iframe'

时间:2016-10-01 14:57:46

标签: vb.net html5 webbrowser-control

我正在Visual Studio 2015中运行一个WebBowser项目,该项目将其部分功能嵌入到另一个添加html文件的网站中。它使用stackoverflow的运行代码片段在没有警告的情况下运行,但是如果我在Visual Studio 2015中运行它,它运行正常,但我得到了这些警告:

  • 200px不是属性宽度的有效值
  • 461px不是属性高度的有效值
  • 元素a不能嵌套在元素iframe

html代码:



<html>
<head>
    <title>Stock Quotes</title>
<style type="text/css">
    body {
     margin-left: 0px;
     margin-top: 0px;
     margin-right: 0px;
     margin-bottom: 0px;
     background-color: Gray;
    }
</style> 
</head>
<body>
    <iframe align="top" allowtransparency="true" marginwidth="0" 
            marginheight="0" hspace="0" vspace="0" frameborder="0" 
            scrolling="no" 
            src="http://api.finance.yahoo.com/instrument/1.0/GOOG,MSFT,ORCL,IBM/badge;quote/HTML?AppID=IEw2Pos2SwyGn532s_VbTecq4mIL&sig=BPVwexNv5yP8zim6MxBootdHqJw-&t=1256412813067" 
            width="200px" height="461px">
                <a href="http://finance.yahoo.com">Yahoo! Finance</a>
                <a href="http://finance.yahoo.com/q?s=GOOG">Quote for GOOG</a>
    </iframe>
</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

widthheight属性不占用单位(%除外)。因此:

... width="200" height="461" ...

对于第二个问题:错误很明显。您在iframe中不能拥有<a>标记。您只能在其中包含文本。有关详细信息,请参阅here

相关问题