Forums / Developer / how to insert images using javascript
Balaji Ramachandran
Wednesday 09 June 2004 9:02:23 am
Actually iam new to ezpublish and i have recieved a website to convert that site using eZPublish and they have used javascript to display the images in loop . but when i use the genral coding to display the image it is not working .please help me to proceed.iam having the javscript coding like this .using this how to display images.
coding (javascript):
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">{literal}
function fnBuildTopMenu(cIn) { var myImg="/images/"; var cTemp = ""; cTemp = cTemp + "<TD><IMG SRC=" + myImg +"_03.jpg WIDTH=155 HEIGHT=107></TD>"; cTemp = cTemp + "<TD><IMG SRC=" + myImg +"_04.jpg WIDTH=155 HEIGHT=107></TD>"; cTemp = cTemp + "<TD><IMG SRC=" + myImg + "_05.jpg WIDTH=154 HEIGHT=107></TD>"; cTemp = cTemp + "<TD><IMG SRC=" + myImg + "_06.jpg WIDTH=155 HEIGHT=107></TD>";
}
my main problem is that variable myImg="/images/",they have decalred it once and called many times by + myImg +_03.jpg etc..,but i have transfered all the images in design/news/images. so how use the ezPublish coding for this to display the image.Please help me to proceed.
Paul Forsyth
Wednesday 09 June 2004 10:00:43 am
I see you are using literals. You need to use the 'literal' tag more often, for example:
cTemp = cTemp + "<TD><IMG SRC=" {/literal}{myImg_03.jpg|ezimage}{literal} WIDTH=155 HEIGHT=107></TD>";
I hope you see what im doing here.
paul
--http://www.visionwt.com
Ekkehard Dörre
Wednesday 09 June 2004 12:01:46 pm
More info:http://ez.no/ez_publish/documentation/customization/tips_tricks/javascript_in_templates
Greetings, ekke
http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing
Trond Åge Kvalø
Thursday 10 June 2004 1:29:56 am
Hi Balaji!
As you say the myImg variable is "/images/". I therefore presume that the images are called _03.jpg, _04.jpg and so on, right?
Then you would use Paul's method and write:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript"> {literal} function fnBuildTopMenu(cIn) { var myImg="/images/"; var cTemp = ""; cTemp = cTemp + "<TD><IMG SRC="{/literal} {_03.jpg|ezimage} {literal}WIDTH=155 HEIGHT=107></TD>"; cTemp = cTemp + "<TD><IMG SRC="{/literal} {_04.jpg|ezimage} {literal}WIDTH=155 HEIGHT=107></TD>";
and so on.
Paul's post had a minor glitch since he used myImg_03.jpg instead of _03.jpg
Hope this helpstrondåge
trondåge
Thursday 10 June 2004 1:37:27 am
Yip, thanks :) My bad cut and paste.
Jorn smith
Monday 01 December 2008 6:39:20 pm
when i search "insert images using javascript", i came here, but my question is how to put a image above another one with js and css. tks
http://www.sales-battery.com
zillion liu
Tuesday 10 February 2009 8:20:42 pm
The "{literal}" is a function library?please tell me how to use it.
-------------------------------------------------http://www.canon-digital-camera-battery.co.uk/batteries/canon-bp-511.htm