Forums / Developer / how to insert images using javascript

how to insert images using javascript

Author Message

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 helps
trondåge

trondåge

Paul Forsyth

Thursday 10 June 2004 1:37:27 am

Yip, thanks :) My bad cut and paste.

paul

--
http://www.visionwt.com

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

eZ debug

Timing: Jan 19 2025 01:03:04
Script start
Timing: Jan 19 2025 01:03:04
Module start 'content'
Timing: Jan 19 2025 01:03:04
Module end 'content'
Timing: Jan 19 2025 01:03:04
Script end

Main resources:

Total runtime0.8036 sec
Peak memory usage4,096.0000 KB
Database Queries214

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0097 588.9766180.8281
Module start 'content' 0.00970.6449 769.8047731.9688
Module end 'content' 0.65460.1489 1,501.7734340.4609
Script end 0.8035  1,842.2344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00460.5774210.0002
Check MTime0.00160.2038210.0001
Mysql Total
Database connection0.00180.220310.0018
Mysqli_queries0.704987.71372140.0033
Looping result0.00230.28122120.0000
Template Total0.760894.720.3804
Template load0.00210.263920.0011
Template processing0.758794.406820.3793
Template load and register function0.00020.027910.0002
states
state_id_array0.00210.256010.0021
state_identifier_array0.00070.089920.0004
Override
Cache load0.00180.2253510.0000
Sytem overhead
Fetch class attribute can translate value0.00190.232570.0003
Fetch class attribute name0.00130.157880.0002
XML
Image XML parsing0.00120.152470.0002
class_abstraction
Instantiating content class attribute0.00000.002080.0000
General
dbfile0.01051.3042270.0004
String conversion0.00000.000630.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 36
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs