如果你是在父框架中使用iframe对象动态写入内容的话,请确保在写入vml脚本前,先将iframe内容初始化即写入
<HTML xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<style> v\:*{Behavior:url(#default#VML)}</style>
</head>
<body>
</body>
</html>
注:style那里的那个v要视你写vml标记的前缀而定了,比如如果你写的是<v:rect>
<HTML xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<style> v\:*{Behavior:url(#default#VML)}</style>
</head>
<body>
</body>
</html>
注:style那里的那个v要视你写vml标记的前缀而定了,比如如果你写的是<v:rect>
父a.html
-----------------------------------------------------------------------
<html>
<script language=javascript>function drawLine()
{
frm1.drawLine();
}
</script>
<body onload=init()>
<input type=button value=画线 onclick=drawLine()><br>
<iframe id=frm1 src=b.html style=width:300;height:300></iframe>
</body>
</html>
-----------------------------------------------------------------------子页面b.html
-------------------------------------------------------------------------
<HTML xmlns:v=\"urn:schemas-microsoft-com:vml\">
<head>
<style> v\:*{Behavior:url(#default#VML)}</style><script language=javascript>
function drawLine()
{
var s = "<v:line from=\"10,10\" to=\"50,50\"></v:line>";
document.body.appendChild(document.createElement(s));
}
</script>
</head>
<body></body>
</html>
-------------------------------------------------------------------------