<style>
     v\:* {behavior: url(#default#VML);}
  </style>
<body>
<script>
vname ="line"  //你在删除的时候对象是line不是line1objvml = "<v:line id='" + vname + "' from='"+cstr(xa)+","+cstr(ya) + "'" +" to='"+cstr(xb)+","+cstr(yb) + "' style=' z-index:200;POSITION:absolute' strokeweight='6' StrokeColor='green'></v:line>"
   objSpan = document.createElement("SPAN");
   objSpan.innerHTML = objvml;
   document.body.insertBefore(objSpan)
</script>
<button onclick="document.all.line.removeNode(true)">Remove</button>

解决方案 »

  1.   

    楼上代码稍作更改,可运行
    <html  xmlns:v><head>
    <meta name="GENERATOR" content="AbsoluteEdit">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
    <title></title>
    </head>
    <STYLE>
    v\:*{behavior:url(#default#VML);} /*声明V为VML变量*/
    </STYLE>
    <body>
    <script>
    vname ="line"  //你在删除的时候对象是line不是line1
    xa=100
    xb=200
    yb=300
    ya=100
    objvml = "<v:line id='" + vname + "' from='"+xa+","+ya + "'" +" to='"+xb+","+yb + "' style=' z-index:200;POSITION:absolute' strokeweight='6' StrokeColor='green'></v:line>"
    objSpan = document.createElement("SPAN");
    objSpan.innerHTML = objvml;
    document.body.insertBefore(objSpan)
    </script>
    <button onclick="document.all.line.removeNode(true)">Remove</button></body></html>