How Can I do it like this?

1 view
Skip to first unread message

BuringRain

unread,
May 15, 2009, 5:40:40 AM5/15/09
to DOMAssistant
It is wrong for me to use like this 'this.gelmsByTag("img")',
except when I call like this 'this.getElementsByTagName("img")'.
if I want to use DOMAssistant ,then how to wright it!


Code:


function binding(){

$(".smallPic li a").addEvent("click",function(){

$$("bigPic").src = this.gelmsByTag("img")[0].src;
});


}




function binding(){

$(".smallPic li a").addEvent("click",function(){

$$("bigPic").src = this.getElementsByTagName("img")[0].src

});


}

Samuel Desnoës

unread,
May 15, 2009, 6:16:08 AM5/15/09
to DOMAssistant
You could try this :

function binding(){
$(".smallPic li a").addEvent("click",function(){
$$("bigPic").src = $$(this).cssSelect("img").first().src;
});
}

Hope this helps...
Best regards,

Sam

chenghong

unread,
May 15, 2009, 6:27:57 AM5/15/09
to DOMAssistant
Hi, the method name is elmsByTag, without the leading 'g'. Anyway,
cssSelect() is the preferred way, as suggested by Samuel.

chenghong

BuringRain

unread,
May 17, 2009, 10:16:47 AM5/17/09
to DOMAssistant
Thank You, My mistake.
Reply all
Reply to author
Forward
0 new messages