您的代码中有一些错误:
allowTransparency不是 CSS 属性。allowtransparency是 iframe 元素上的一个属性。并且您将 allowTransparency 编写为 CSS 属性。
试试这个代码 -
jQuery('<iframe id="accountframe" style="position: absolute; width: 290px; height:140px; margin-top: 0px; margin-left: 0px; top:0px; left:0px; text-align:left overflow:hidden;" allowTransparency="false" src="test.jsp" ></iframe>').appendTo('#account');
有这篇文章
正如您所提到的,您也可以尝试allowTransparency="false"作为一个属性,但如果您想让您的IFrame透明。您需要allowTransparency="true"在 iframe 上进行设置。
确保 theIFRAME及其源BODY元素都应用了background:transparent样式规则:
<iframe frameborder="0" allowTransparency="true" style="background:transparent" ... ></iframe>
在源代码中:
<body style="background:transparent">
PS:上面的 CSS 样式是内联的,例如。
尝试这个:
jQuery('<iframe id="accountframe" style="position: absolute; width: 290px; height:140px; margin-top: 0px; margin-left: 0px; top:0px; left:0px; text-align:left overflow:hidden;" allowTransparency="true" src="test.jsp" ></iframe>').appendTo('#account');