加入insert参数,然后自己设置一下位置,搞定..... 程序修改如下:<html xmlns:v>
<STYLE>
v\:*{behavior:url(#default#VML);} //声明变量v为VML对象
</STYLE>
<body>
<v:Group id=grouphjm style="Z-INDEX:10;LEFT:0px;POSITION:relative;TOP:0px; WIDTH:400px;HEIGHT:400px;" 
  coordsize="100,-100" coordorigin="50 -50" >
<!--X轴-->
<v:Line style="Z-INDEX:3" from="-30,0" to="30,0" strokecolor="blue" strokeweight="1pt">
<v:stroke endarrow="classic" dashstyle="dashdot">
</v:stroke>
</v:Line>
<!--Y轴-->
<v:Line style="Z-INDEX:8" from="0,-20" to="0,20" strokecolor="blue" strokeweight="1pt">
<v:stroke endarrow="classic" dashstyle="dashdot">
</v:stroke>
</v:Line>
<v:roundrect style='left:-20;top:-20;width:18;height:10;' fillcolor="red">
<v:textbox inset="0px,-40px,0px,0px">
<a href="http://www.msdn.com/"><font size=2>Click here</font></a>
</v:textbox>
</v:roundrect>
</v:Group>
</body>

解决方案 »

  1.   

    谢谢 bguest(bguest)!
    inset的四个参数中后两个含义是什么?
      

  2.   

    我通过js怎么就不能把字放到rect中
    <html xmlns:v>
    <STYLE>
    v\:*{behavior:url(#default#VML);} //声明变量v为VML对象
    </STYLE>
    <html xmlns:v>
    <STYLE>
    v\:*{behavior:url(#default#VML);} //声明变量v为VML对象
    </STYLE>
    <script>
        obj_TextRect=document.createElement("v:rect")
        obj_TextRect.style.left=20   
        obj_TextRect.style.top=20    
        obj_TextRect.style.height=18
        obj_TextRect.style.width=10    obj_TextBox=document.createElement("v:textbox")
        obj_TextBox.inset="0,0,0,0"
        obj_TextBox.innerText="asdfasdfsadfsadfsdafsdaf"
        obj_TextRect.appendChild(obj_TextBox)
        grouphjm.appendChild(obj_TextRect)</script>
      

  3.   

    不是很明白你的意思,是不是这样啊...... 直接保存为html打开来看效果<script>
      function AddFont(){
        obj_TextRect=document.createElement("v:rect")
    obj_TextRect.id="bguest"
        obj_TextRect.style.left=10   
        obj_TextRect.style.top=10    
        obj_TextRect.style.height=10
        obj_TextRect.style.width=20    obj_TextBox=document.createElement("v:textbox")
        obj_TextBox.inset="10px,-30px,20px,0px"
    obj_TextBox.innerText="test"
        obj_TextRect.appendChild(obj_TextBox)
    // alert(obj_TextBox.value)
        document.all.grouphjm.appendChild(obj_TextRect)
      }
    </script><html xmlns:v>
    <STYLE>
    v\:*{behavior:url(#default#VML);} //声明变量v为VML对象
    </STYLE>
    <body>
    <input type="button" value="AddFont" onclick="AddFont()">
    <v:Group id=grouphjm style="Z-INDEX:10;LEFT:0px;POSITION:relative;TOP:0px; WIDTH:400px;HEIGHT:400px;" 
      coordsize="100,-100" coordorigin="50 -50" >
    <!--X轴-->
    <v:Line style="Z-INDEX:3" from="-30,0" to="30,0" strokecolor="blue" strokeweight="1pt">
    <v:stroke endarrow="classic" dashstyle="dashdot">
    </v:stroke>
    </v:Line>
    <!--Y轴-->
    <v:Line style="Z-INDEX:8" from="0,-20" to="0,20" strokecolor="blue" strokeweight="1pt">
    <v:stroke endarrow="classic" dashstyle="dashdot">
    </v:stroke>
    </v:Line>
    <v:roundrect style='left:-20;top:-20;width:18;height:10;' fillcolor="red">
    <v:textbox inset="0px,-40px,0px,0px">
    <a href="http://www.msdn.com/"><font size=2>Click here</font></a>
    </v:textbox>
    </v:roundrect>
    </v:Group>
    </body>
    </html>
      

  4.   

    我试了下: inset中的四个参数中分别是:left、top、width和height
    再次谢谢 bguest(bguest)!