...

View Full Version : function not defined?



neridaj
06-20-2008, 10:14 PM
Hello,

I don't understand why this function is not defined:


function swapimg(in)
{
alert(in);
var imgname;
imgname = in;
window.parent.document.getElementById('ifrmtarget').src="images/" + in + ".jpg";
}

I'm calling it like this:

<a href="#" onclick="swapimg(00)" >

If you see the problem, would you please let me know.

Thanks,

Jason

Stooshie
06-21-2008, 12:32 AM
you can't use the variable name in, it's a reserved word.


function swapimg(testin)
{
alert(testin);
var imgname;
imgname = testin;
window.parent.document.getElementById('ifrmtarget').src="images/" + testin + ".jpg";
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum