[thelist] Javascript onclick doesn't fire?
Lee kowalkowski
lee.kowalkowski at googlemail.com
Tue Aug 22 15:47:30 CDT 2006
On 22/08/06, Stephen Rider <evolt_org at striderweb.com> wrote:
> And example of the onclick that is added:
> onclick="openCamHR(360,270,640,480,this.href,'View 1 - ' + this.alt);
> return false;"
You're assigning to a string where a function object is expected.
This will work better:
obj.onclick = function()
{
openCamHR(360,270,640,480,this.href,'View 1 - ' + this.alt);
return false;
}
That's just an anonymous inline function. You could do the following
for better readability.
function openCam()
{
openCamHR(360,270,640,480,this.href,'View 1 - ' + this.alt);
return false;
}
obj.onclick = openCam;
This can easily be adapted for passing into an attach event
method/system of your choosing, if you're worried about overwiting
existing onclick definitions.
--
LK
More information about the thelist
mailing list