2016-10-01 51 views
0

我正在Visual Studio 2015中的一个WebBowser项目中嵌入一部分功能在另一个网站中添加一个html文件。它运行,而无需使用计算器的运行代码片断警告,但如果我在Visual Studio 2015中运行它,它运行正常,但我得到这些警告:元素'a'不能嵌套在元素'iframe'中

  • 200像素不是属性的有效值宽度
  • 461px不是属性高度
  • 元素的有效值的不能嵌套元件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>

回答

0

width的和height属性不采取单元(除%)。因此:

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

对于第二个问题:错误很明显。 iframe中不能有<a>标签。你只能在里面有文字。有关更多详细信息,请参阅here

+0

修正了所有问题。谢谢。 –