12-03-2008, 05:38 AM
|
#1 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
|
how would i echo this javascript variable
i'm trying to echo this variable to the screen
Code:
thumbs = document.getElementById("thumbnailPane").getElementsByTagName("img");
the way i am echoing the value out is i have a div named output so i did
Code:
document.getElementById('output').innerHTML = 'field: ' + thumbs;
but when i did that i get this
Code:
field: [object HTMLImageElement]
is there another way of doing it?
here is the whole peice of js code i'm using if ur interested.
Code:
window.onload = initPage;
function initPage() {
thumbs = document.getElementById("thumbnailPane").getElementsByTagName("img");
for (var i = 0; i < thumbs.length; i++) {
image = thumbs[i];
//myoutput:
document.getElementById('output').innerHTML = 'field: ' + thumbs;
image.onclick = function() {
detailURL = 'images/' + this.title + '-detail.jpg';
document.getElementById("itemDetail").src = detailURL;
getDetails(this.title);
}
}
}
i also tried doing thumbs[i] and echoing the image variable but it shows the same output.
__________________
no signature set
|
|
|
|