抱歉我的英文不好:我试图用IE8在iframe上覆盖图像时遇到问题
在我的例子中,我必须在按下按钮的iframe上放置图像。
仅当iframe包含html页面时,它才有效
当iframe加载xslt页面时,我看不到图像。
它在Safari和Chrome中都能正常工作
任何建议将不胜感激!
提前谢谢。
function Place() {
document.getElementById("image").style.left = '180px';
document.getElementById("image").style.top = '150px';
// show the picture
document.getElementById("image").style.display = "block";
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>place the picture</title>
</head>
<body>
<iframe name="frm1" style="width:49%; height:300px; position:relative;" src="/zzzzz.xml"></iframe>
<div id="image" style="position:absolute; z-index:5; display:none">
<img src="/img/ingr.gif" border="0">
</div>
<div>
<input type="button" onclick="Place()" value="Place the picture"/>
</div>
</body>
</html>
这是我的xsl页面:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
...这是xml数据:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xframe.xsl"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>disco 2</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>15.20</price>
<year>1980</year>
</cd>
</catalog>