VML 图形不经任何处理只有在 ie5 版本下才能生效。
js动态添加图形无需 style 命名空间。但是静态的图形 就必须要添加 style.
<STYLE>
v\:* {
Behavior:
url(
#default#VML) }
/* 命名空间“v” */
</STYLE>
- js例子
<script type="text/javascript">
<!-- 添加背景蓝色 方框 -->
document.write('<v:shape id="RECT" CoordOrig="10,0" CoordSize="100,100" style="width:100px;height:100px; background:#06C" />');
document.
getElementById(
"RECT").οnclick=
function(){
alert(
this.
id)}
</script>
- 静态例子