use public:property, otherwise, there is no way to pass the property through

解决方案 »

  1.   

    var a = input2.disabled
      

  2.   

    设置public:property也不起作用,必须调用一次xx.disabled=true才行。
    是不是默认属性都会有这个问题?
      

  3.   

    如果将x.htc改为
    <public:component tagname="input2">
    <public:defaults viewLinkContent=true contentEditable=false />
    <public:property name="disabled" put="putDisabled" get="getDisabled" />
    <attach event=oncontentready onevent="init();" />

    </public:component><body>
    <script language=javascript>
    function putDisabled(bDisabled) {
    i1.disabled = bDisabled;
    i2.disabled = bDisabled;
    }function getDisabled() {
    return element.disabled;
    }function init() {
    putDisabled(disabled)
    }
    </script>
    <input id=i1 type="text"><input id=i2 onclick=alert("OK") type="button">
    </body>会产生一个stack overflow信息
      

  4.   

    remove init(), add a variable inside your code, try
    <script language=javascript>
    var m_bDisabled = false;
    function putDisabled(bDisabled) {
             m_bDisabled = bDisabled;
    i1.disabled = m_bDisabled;
    i2.disabled = m_bDisabled;
    }function getDisabled() {
    return m_bDisabled;
    }</script>
      

  5.   

    如果这样的话,最开始设置的<... disabled=true>就没用了,必须在程序调用一次。
      

  6.   

    viewLinkContent 只能在IE5.5或者更高的IE才能有效,使用HTC,建议动态生成HTML代码,那样IE5.0 也能够使用,动态生成HTML后,把<input>设置成HTC中的全局变量,那样就可以动态改变<input>的属性了...livingagain (阿甘) 真高兴看到有研究HTC的朋友,交个朋友吧,我最近也在研究HTC,
    我的QQ是:2649477
     email: [email protected]
      

  7.   

    <PUBLIC:ATTACH  event="oncontentready"         onevent="createHTC()"/> <!-- 创建可视组件 -->
    <SCRIPT language="JScript">
    var oTopButton=oDIV=oBar=oBottomButton=null;...function init(){
      oTopButton=document.createElement("<button style='position:relative;top:0;left:0;font-family:Webdings;width:17;height:20;'></button>");
      oDIV.insertBefore(oTopButton);
      oTopButton.innerHTML="<span style='position:relative;top:-3;left:-1;'>5</span>"; 
      oTopButton.onmousedown=new Function("canAdd=true;plusPos()");
    }...function disabled()
    {
      oTopButton.disabled=true;
    }...
      

  8.   

    it seems you cannot override an intrinsic property like "disabled", try to use a property name like "mydisabled"
      

  9.   

    disabled改为mydisabled同写个setDisabled()方法也没什么区别,最好还是能找个直接用disabled的思路来,其实其他的标准属性也要用到这个思路。linhaibo(美洲豹): 很高兴有同道中人,.cn,我从不上网聊天,大家可以用邮件联络。
      

  10.   

    found a solution for you:
    htc.html:
    <HTML xmlns:IE>
    <?IMPORT namespace=IE implementation="htc.htc" >
    <BODY bgcolor="white">
    <IE:input2 id=xx border=0 disabled=true></IE:input2><br>
    <input type="button" value="change" onclick="xx.disabled = !xx.disabled">
    <body>
    </HTML>
    htc.htc:
    <public:component tagname="input2">
    <public:defaults viewLinkContent=true contentEditable=false />
    <attach event=oncontentready onevent="init();" />
    <script language=javascript>
    function init()
    {
       i1.setExpression("disabled","element.disabled");
       i2.setExpression("disabled","element.disabled");
    }
    </script>
    <input id=i1 type="text"><input id=i2 onclick=alert("OK") type="button" value="ok">
    </public:component>
      

  11.   

    搞定,多谢karma(无为)兄。另外,karma(无为)兄能否告诉我,根据你的经验,动态属性对性能影响大不大?动态属性到底是定时重算还是实践触发机制?http://www.microsoft.com/china/msdn/msdnonline/features/articles/dhtmlperf.asp#dhtmlperf_topic8
    请勿过多使用动态属性:
    动态属性(英文)为 Web 作者提供了一种将表达式用作属性值的方法。表达式在运行时计算,其结果值将应用于属性。这是一个强大的特性。此特性可用于减少页面上的脚本数量,但是因为必须定时重算表达式,而且该表达式经常与其他属性值相关,所以它会对性能带来消极的影响。这种情况对定位属性尤其明显。
      

  12.   

    as long as you do not have many expressions, you will be fine. I think it is 定时重算