[ic] Re: Path in javascript function

interchange-users@icdevgroup.org interchange-users@icdevgroup.org
Wed Oct 2 10:02:02 2002


Götz Verdieck writes: 

> Hi, 
> 
> I have a problem with the path expanding.
> I use the following path :
> src="__THEME_IMG_DIR__pic_allg/pic_wahl.gif" 
> 
> When I have a look at the html source the result I get is:
> src="/kabelshop/images/deutsch/foundation/pic_allg/pic_wahl.gif" 
> 
> That¹s exactly what I expected but when I use this
> in a Javascript code like: 
> 
> .......
> <script type="text/javascript" language="JavaScript1.2"><!--
>   
> function staffelwahl() {
> var bild2 = new Image();
> artgesamt = eval(document.berechnen.gesamt.value)+eval([scratch artquant]);
> staffel = new Array([scratch staffel_komma]);
> for ( var i= 0;  i <=staffel.length-1; i++) {
> {
>  if  ((staffel[i] <= artgesamt) && (artgesamt  < staffel[i+1])) {
>       bild2.src="__THEME_IMG_DIR__pic_allg/pic_wahl.gif";
>       document.wahl[i].src = bild2.src;
>   } 
> 
>   else
>   {
>     bild2.src="__THEME_IMG_DIR__pic_allg/pic_nwahl.gif";
>     document.wahl[i].src = bild2.src;
>   }
> ........ 
> 
> I get: 
> 
> bild2.src="foundation/pic_allg/pic_wahl.gif" 
> 
> But I would like to see:
> bild2.src="/kabelshop/images/deutsch/foundation/pic_allg/pic_wahl.gif" 
> 
> Where is the first part (/kabelshop/images/deutsch/) gone ? 
> 
> I tested this again and again. What am I doing wrong ?

Interchange parses most of the HTML tags with image URLs and
prepends them with the ImageDir configuration value. In a
foundation-based catalog try: 

bild2.src="__IMAGE_DIR__/__THEME_IMG_DIR__pic_allg/pic_nwahl.gif"; 

Ciao
      Racke 


-- 
Prolific Interchange Consulting (Excellent German Quality !).
Take a look at Materialboerse (http://www.materialboerse.de/), WITT
(http://www.witt-weiden.de/), Boxmover (http://shop.boxmover.ch/) or
Passionshop (http://www.passionshop.com/racke). Need a shop ? Contact us.