skydive74 Posted August 11, 2010 Posted August 11, 2010 Hi, I've been searching in the forums for this but only ended up with mouseover events. Please help me! I want my header linked images to switch after I click on them, but was unsuccessful after my numerous blind tries. I'm sure it's not too hard but after playing around for 2 days, I still cannot find the correct way or syntax to make this happen. The following line is from my headers.php: <a href="<?php echo tep_href_link('index.php')?>"><?php echo tep_image_button('m1.jpg')?></a><a href="<?php echo tep_href_link('products_new.php')?>"><?php echo tep_image_button('m2.jpg')?></a><a href="<?php echo tep_href_link('specials.php')?>"><?php echo tep_image_button('m3.jpg')?></a><a href="<?php echo tep_href_link('account.php')?>"><?php echo tep_image_button('m4.jpg')?></a><a href="<?php echo tep_href_link('contact_us.php')?>"><?php echo tep_image_button('m5.jpg')?></a> ...and I've tried playing around in the html_output.php on the following line, which I think is the better way so I can make different images for my different languages (I can get onmouseover to work but I want onclick) : // Output a function button in the selected language function tep_image_button($image, $alt = '', $parameters = '') { global $language; return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters); } Any help will be greatly appreciated. Thanks, Tommy Quote
web-project Posted August 11, 2010 Posted August 11, 2010 using javascript you can enable the image swap, simply do the google search and you will find code. Quote Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here! 8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself. Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues. Any issues with oscommerce, I am here to help you.
GavinJary Posted December 7, 2010 Posted December 7, 2010 I have been after the onmouseover to this very problem at the exact same place on the template. Can you please post the code that got this to work on here. My normal working mouseover image swap script is refusing to work with <?php echo tep_image_button('')?>. Just to point out the Href part works fine to link to home in all the languages. It appears to me that neither the first or rollover image can be found. If Skydive74 is no longer around i would be eternally grateful for some help, code adjustments that will get this working smoothley. MANY THANKS IN ADVANCE. My HTML: <a href="<?php echo tep_href_link('home.php')?>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('aarjart home','','<?php echo tep_href_link('m1')?>',1)"><img src="<?php echo tep_href_link('m1_press')?>" alt="aarjart home" name="aarjart home" border="0" id="aarjart home" /></a></td> My MOUSEOVER SCRIPT: <!-- START MOUSOVER SCRIPT--> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } 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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } 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[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> <!-- END MOUSOVER SCRIPT--> Quote
GavinJary Posted December 7, 2010 Posted December 7, 2010 SORRY GUYS IGNORE POST 3 I MADE A MISTAKE IN MY HTML CODE. PROBLEM IS BELOW. THANKS I have been after the onmouseover to this very problem at the exact same place on the template. Can you please post the code that got this to work on here. My normal working mouseover image swap script is refusing to work with <?php echo tep_image_button('')?>. Just to point out the Href part works fine to link to home in all the languages. It appears to me that neither the first or rollover image can be found. If Skydive74 is no longer around i would be eternally grateful for some help, code adjustments that will get this working smoothley. MANY THANKS IN ADVANCE. My HTML: <a href="<?php echo tep_href_link('home.php')?>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('aarjart home','','<?php echo tep_image_button('m1.gif')?>',1)"><img src="<?php echo tep_image_button('m1_press.gif')?>" alt="aarjart home" name="aarjart home" border="0" id="aarjart home" /></a></td> My MOUSEOVER SCRIPT: <!-- START MOUSOVER SCRIPT--> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc; } 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.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}} } 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[n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.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))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } </script> <!-- END MOUSOVER SCRIPT--> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.