S
SkewsMe.com
Guest
I have function that works:
function CityCommit()
{document.write('<map name="' + this.name + 'map">');
for (var i=0; i<this.locations.length; i++)
{
document.write('<area shape="rectangle" coords="' + this.locations.x +',' + this.locations.y + ',' + parseInt(this.locations.x+15) + ',' + parseInt(this.locations.y+15) + '" href="#" title="' + this.locations.name + '" onclick="document.getElementById (\'comments\').innerHTML=\'' + this.locations.name + '<br>' + this.locations.data + '\'">');
}
document.write('</map>');
}
but when I try to replace the code referenced by the ONCLICK with my own function call, it just refuses to work. I either get the variable 'i' and/or function 'this.dothang(i)' doesn't exist or it executes every instance of the function this.dothang(i) for 'i' and gets stuck permanently on the final one.
function CityCommit()
{document.write('<map name="' + this.name + 'map">');
for (var i=0; i<this.locations.length; i++)
{
document.write('<area shape="rectangle" coords="' + this.locations.x +',' + this.locations.y + ',' + parseInt(this.locations.x+15) + ',' + parseInt(this.locations.y+15) + '" href="#" title="' + this.locations.name + '" onclick="document.getElementById (\'comments\').innerHTML=\'' + this.locations.name + '<br>' + this.locations.data + '\'">');
}
document.write('</map>');
}
but when I try to replace the code referenced by the ONCLICK with my own function call, it just refuses to work. I either get the variable 'i' and/or function 'this.dothang(i)' doesn't exist or it executes every instance of the function this.dothang(i) for 'i' and gets stuck permanently on the final one.