我使用的是document.write
<html xmlns:v="urn:schemas-microsoft-com:vml">
<style type="text/css">
v\:* { Behavior: url(#default#VML) };
</style>
<body>
<v:RoundRect fillcolor="#fff333" arcSize="2%" style="position:relative;width:590;height:560px;"> <v:stroke color="#BFBF28"/> <v:shadow on="T" type="single" color="#C96800" offset="5px,5px"/> <v:TextBox inset="0pt,0pt,0pt,0pt">asdfsdf
</v:TextBox></v:RoundRect>
</body>
<script>
document.write('<v:RoundRect fillcolor="#fff333" arcSize="2%" style="position:relative;width:590;height:560px;"> <v:stroke color="#BFBF28"/> <v:shadow on="T" type="single" color="#C96800" offset="5px,5px"/> <v:TextBox inset="0pt,0pt,0pt,0pt">asdfsdf</v:TextBox></v:RoundRect>');
</script>

解决方案 »

  1.   

    document.write是DHTML中的东西!
    不能动态生成,也不能响应事件!
    我想要js生成的!
      

  2.   

    <html xmlns:v="urn:schemas-microsoft-com:vml">
    <style type="text/css">
    v\:* { Behavior: url(#default#VML) };
    </style>
    <body>
    <script>
    document.write('<v:TextBox>sssssssssssssssssss</v:TextBox>');
    </script>
    </body>
      

  3.   

    如果用document.write的话,
    会清除页面的所有数据;
    不知道怎么避免?
    就是怎样在页面上的任意一个位置添加文字?
      

  4.   

    <html xmlns:v="urn:schemas-microsoft-com:vml">
    <style type="text/css">
    v\:* { Behavior: url(#default#VML) };
    </style>
    <body>
    <div id="notextbox">no textbox here</div>
    <div id="yestextbox"></div>
    <script>
    yestextbox.innerHTML = ('<v:TextBox>sssssssssssssssssss</v:TextBox>');
    </script>
    </body>
      

  5.   

    楼上的也是一种办法!
    不过,我是想在已有的图(坐标系)里加文字;
    我想一般的要求都是这样:
    就是给已有的直线添加文字,写明起止点的坐标!
    附加我的源码:
    for(var i=0;i<data.length;i++)
    {
    var px=50+4800/data.length*i;
    var newLine;
    newLine=document.createElement("<v:line from='"+px+",2850' to='"+px+",2870' style='Z-INDEX:2;'></v:line>");
    window.group1.insertBefore(newLine);
    var newTextbox = document.createElement("<v:textbox  style='FONT-SIZE:13;COLOR:#f81ad2;width:40px;height:20px' >"+(i+1)+"月"+"</v:textbox>");
    newLine.insertBefore(newTextbox);

    }画直线的能看到效果;
    添加文字的看不到效果;
    不知道该如何实现!请执教!
      

  6.   

    另外,
    document和VML的坐标系不同!
    如果用document,还需要转化!
      

  7.   

    document.write('<span style="FONT-SIZE: 10px; LEFT:'+ leftdis +'; POSITION: absolute; TOP:' + topdis +';">'+m+'</span>')leftdis:要写字的位置距离左边缘的距离
    topdis:要写字的位置距离上边缘的距离
    m: 要写的文字或者其他内容这样就可以直接在页面写字了,而且也不会覆盖本来的东西。我现在就是用这个在画出的直线上面标号的。很好用,没有覆盖问题。