Forums / Setup & design / ezimage operator with onload event

ezimage operator with onload event

Author Message

RW Wood

Sunday 14 September 2003 8:18:37 pm

I'm using a body onload event for preloading images, and it requires that the image src's be enclosed in single, not double quotes. I've tried using ezimage, but it doesn't seem to like single quotes.

Example:
body onload="preloadImages('path/img1.gif')"
becomes:
body onload="preloadImages('{"img1.gif"|ezimage}')"
which translates on the rendered page to:
body onload="preloadImages('"path/img1.gif"')" note the nested quotes around the image, which doesn't work.

Is there a way to get around this without having to use full paths in the pagelayout.tpl file?

Thanks.
RWW

Paul Forsyth

Monday 15 September 2003 12:39:15 am

Have you tried:

preloadImages({"path/img1.gif"|ezimage})

Ezimage will output a string with the quotes in place so you dont need to wrap the call.

Paul

RW Wood

Monday 15 September 2003 11:45:25 am

I'll give it a try, but what then happens to the quote that needs to be before preloadImages and after the last ) ? You can't nest double quotes inside double quotes, and I don't think the preloadImage function will work if it's wrapped in single quotes.

Or am I wrong?

Thanks
RWW

Sébastien Prud'homme

Wednesday 17 September 2003 7:25:58 am

I use this in my templates :

onLoad='preloadImages({"roll1b.jpg"|ezimage})'