document.getElementById in alpha2 - Ext JS

用户在从ExtJS 0.33版本迁移到Alpha2时遇到问题,无法将标签添加到工具栏中。尝试使用`document.getElementById`和`Ext.get`获取元素均未成功,错误提示元素不存在。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hi, before migrate to alpha2 in 0.33 I had to add a label to a toolbar this code

var feedtb = new Ext.Toolbar('mystatus-tb');
.....
var lbUserLogged = document.getElementById('lbUsername');
feedtb.add(lbUserLogged);

now in alpha2 get this error

el has no properties
http://localhost/asfa/ext-all.js
Line 110


I was trying var lbUserLogged = Ext.get('lbUsername'); but the same, so how I can do it now from alpha2?


kind regards
Frank
Reply With Quote
  #2  
Old 02-25-2007, 10:13 AM
Default

It works the same. That error means the element you are passing doesn't exist.

Try this:

var lbUserLogged = document.getElementById('lbUsername');
alert(lbUserLogged);
Reply With Quote
  #3  
Old 02-25-2007, 06:49 PM
Default

Jack you are right is null, but with 0.33 it work, now I move the label and work

<div id="status" class="x-layout-inactive-content">
<div id="hello-user" style="VISIBILITY: hidden">
<ASP:Label id="lbUsername" runat="server">Userlogged</ASP:Label>
</div>
<div id="mystatus-tb" style="MARGIN-TOP: -11px">

</div>

</div>

the var lbUserLogged = document.getElementById('lbUsername'); don't work when the component is inside the toolbar I mean:

<div id="status" class="x-layout-inactive-content">
<div id="hello-user" style="VISIBILITY: hidden">

</div>
<div id="mystatus-tb" style="MARGIN-TOP: -11px">
<ASP:Label id="lbUsername" runat="server">Userlogged</ASP:Label>
</div>

</div>

I wrote it becouse I don't know if correct it or is a trouble in ext1

kind regards
Frank
Reply With Quote
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值