luke83
5 Nov 2006, 6:30 PM
i'm using this code:
var rListMsgs = new function(){
this.render = function(el, response){
var dh = YAHOO.ext.DomHelper;
var obj = response.responseText;
obj=obj.split("\n");
for (v in obj)
dh.insertBefore('item0', {tag: 'li', html: obj[v]});
}
}();
var dh = YAHOO.ext.DomHelper;
dh.append('container',{tag:'div',id:'room', html:'prova'});
dh.append('room', {tag: 'ul', children: [
{tag: 'li', id: 'item0', html: 'List Item 0'}
]
});
room = getEl("room").getUpdateManager();;
room.setRenderer(rListMsgs);
room.update('msg.php');
room.startAutoRefresh(4,'msg.php');
to try to add before the element item0 inside the list in the room div other elements to the list
[dom tree]
-div (room)
--ul
<-- here i wanna be :D
---li (item0)
[/dom tree]
the code don't work.. :cry:
also if i use .append method it only replace the whole room content and not - as i would - only add li elements to the ul inside room div
what is wrong?
ps:
msg.php output is:
item1
item2
....
....
...
var rListMsgs = new function(){
this.render = function(el, response){
var dh = YAHOO.ext.DomHelper;
var obj = response.responseText;
obj=obj.split("\n");
for (v in obj)
dh.insertBefore('item0', {tag: 'li', html: obj[v]});
}
}();
var dh = YAHOO.ext.DomHelper;
dh.append('container',{tag:'div',id:'room', html:'prova'});
dh.append('room', {tag: 'ul', children: [
{tag: 'li', id: 'item0', html: 'List Item 0'}
]
});
room = getEl("room").getUpdateManager();;
room.setRenderer(rListMsgs);
room.update('msg.php');
room.startAutoRefresh(4,'msg.php');
to try to add before the element item0 inside the list in the room div other elements to the list
[dom tree]
-div (room)
--ul
<-- here i wanna be :D
---li (item0)
[/dom tree]
the code don't work.. :cry:
also if i use .append method it only replace the whole room content and not - as i would - only add li elements to the ul inside room div
what is wrong?
ps:
msg.php output is:
item1
item2
....
....
...