...

View Full Version : A simple question about javascript ?



bigtiger
10-21-2006, 08:05 AM
function update()
{
var photoMgt = new PhotoManager();
photoMgt.create_image("http://localhost/1.jpg"); /* this works */
photoMgt.add("http://localhost/1.jpg"); /* but this not */
}

function PhotoManager()
{
this.idx = 0;
this.image_ary = new Array();
this.add = add;
this.create_image = create_image;
}

function add(url)
{
if (typeof(url) == 'string' && (url.indexOf("http://") == 0))
{
if (this.create_image(url))
{
return true;
}
else
{
return false;
}
}
}

function create_image(url)
{
alert(this.idx); /* directly called with create_image will work, but will add function will not */
var im = new Image();
if ((im) && (im.tagName.toLowerCase() == 'img'))
{
with (im)
{
src = url;
border = 0;
}
this.image_ary.push(im);
return true;
}
return false;
}

hi, I have this simple question is here not way to make this indirectly reference variable ?

Thanks you,

bigtiger
10-21-2006, 09:43 AM
I'am got remember I can have to use push method as alternate but still can't access the image_ary. any help would be appreciate.

Thanks you



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum