![]() |
Help please (Dreamweaver javascript problemo)
Hi,
I took customer home.tpl code and pasted it into Dreamweaver MX. I could visibly see the table layout in dreamweaver and I added my own tables and rows and insterted an image with swap image behaviour, I then took the code and pasted it back in xcart but I get errors. Can someone please explain what is going on? Thank you |
probably the javascript.
search for "literal" |
literal
Hi this is my code BEFORE adding literal tags:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> {* $Id: home.tpl,v 1.42 2002/10/22 10:27:05 olga Exp $ *} { config_load file="$skin_config" } <html> <head> <title>{$lng.txt_site_title} {if $main eq "catalog"} {if $location eq ""} {$lng.txt_subtitle_home} {else} {strip} {section name=position loop=$location start=0 } {if %position.last% eq "true"} - {$location[position].0|escape}{/if} {/section} {/strip} {/if} {elseif $main eq "product"} {if $product.product ne ''} - {$product.product}{/if} {elseif $main eq "help"} {$lng.txt_subtitle_help} {elseif $main eq "cart"} {$lng.txt_subtitle_cart} {elseif $main eq "checkout"} {$lng.txt_subtitle_checkout} {elseif $main eq "order_message"} {$lng.txt_subtitle_thankyou} {/if} </title> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <body onLoad="MM_preloadImages('%7B$ImagesDir%7D/missy.jpg')"> { include file="meta.tpl" } <link rel="stylesheet" href="{$SkinDir}/{#CSSFile#}"> </head> <body LEFTMARGIN=0 TOPMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0> { include file="rectangle_top.tpl" } {* { include file="head.tpl" } *} <table border=0 width=100% cellpadding=0 cellspacing=0 align="center"> <tr> <td class=VertMenuBox></td> <td colspan="3" valign=top class=VertMenuBox>[img]{$ImagesDir}/missy2.jpg[/img]</td> <td></td> <td valign=top></td> </tr> <tr> <td class=VertMenuBox width=6></td> <td class=VertMenuBox width=150 valign=top> { include file="customer/categories.tpl" } {if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu eq "Y"} { include file="modules/Bestsellers/menu_bestsellers.tpl" } {/if} {if $active_modules.Gift_Certificates ne ""} { include file="modules/Gift_Certificates/gc_menu.tpl" } {/if} { include file="help.tpl" } </td> <td width=20></td> <td valign=top> {include file="customer/home_main.tpl"} </td> <td width=20></td> <td width=150 valign=top> { include file="customer/menu_cart.tpl" } {if $login eq "" } { include file="auth.tpl" } {else} { include file="authbox.tpl" } {/if} { include file="news.tpl" } { include file="poweredby.tpl" } </td> </tr> <tr> <td class=VertMenuBox></td> <td class=VertMenuBox></td> <td></td> <td>{ include file="copyright.tpl" }</td> <td></td> <td></td> </tr> </table> { include file="rectangle_bottom.tpl" } </body> </html> |
this is my after:
<script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() {literal} //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} {/literal} function MM_swapImgRestore() {literal}//v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; {/literal} function MM_findObj(n, d) {literal} //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; {/literal} function MM_swapImage() {literal} //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} {/literal} //--> </script> |
hi
I dont get any errors but my swap image behaviour does not work.
.... |
Try
Code:
{literal} |
shan
Shan,
thank you sir. The image now swaps but it swaps to a red x . I have both of my images in the skin1/images folder so why is it not swapping to the correct image? |
not sure,
get it working in a normal page then add the code to the xcart page and remember to wrap the entire javascript bit in literal tags. sounds like it cant find the rollover image. must be looking in the wrong place |
...
shan,
I have it working locally on my computer then I upload the code and add {$ImagesDir} in front of the pictures like I'm supposed to. The image is there but it doesn't swap, I don't understand how it cannot find the image even if I add {$ImagesDir} in front of the image to swap or even skin1/images/ in front of it. |
Thank you Shan,
I got it to work! |
All times are GMT -8. The time now is 02:08 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.