PDA

View Full Version : document.getElementById in alpha2



franklt69
25 Feb 2007, 7:27 AM
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

jack.slocum
25 Feb 2007, 8:13 AM
It works the same. That error means the element you are passing doesn't exist.

Try this:

var lbUserLogged = document.getElementById('lbUsername');
alert(lbUserLogged);

franklt69
25 Feb 2007, 4:49 PM
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