document 前面加上 window.

解决方案 »

  1.   

    补充一下上面说过drawNormal()在同一个Html页面可以使用,这说明不是VML的使用问题。另外:为了排除是HTC使用上的问题,将vmlTabA.htc增加了一些普通内容,如下:<public:component tagName=vmlTabA>
    <public:defaults viewLinkContent/> 
    <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="drawNormal()" />

    <script language="javascript" src="MyVML.js"></script>
    <SCRIPT LANGUAGE="JScript" >
    function drawNormal(){
    thisDiv.innerHTML = element.innerHTML;
    var thisGroup;
    thisGroup = createGroup("90px", "20px", "900, 200");
    thisGroup.style.position="relative";
    thisGroup.style.left="1px";
    thisGroup.style.top="1px";

    thisGroup.appendChild(createRect("900px","200px","#444444","#444444"));
    thisGroup.appendChild(createPolyLine("0,200 0,0 700,0 900,200", "#AABBCC", "1", "false"));
    thisGroup.appendChild(createPolyLine("0,200 900,200","#FF0000","1","false"));
    document.body.appendChild(thisGroup);
    }
    </SCRIPT>
    </public:component><div id=thisDiv style="width:100px; height:30px; background-color:#DDDDDD">kkk</div>“thisDiv.innerHTML = element.innerHTML;”正确的执行,可以说明htc文件格式本身没有问题。
      

  2.   

    非常抱歉,htc中的document前面忘记加上window。问题解决。再次感谢Naola2001(摆地摊.Net) !