![]() |
adding javascript to customer home.tpl
Hi All,
I'm trying to get two javascript functions to run on the home.tpl I've put the relevant script info between the "literal" tags as below: Code:
And, I've added the onload call in the body tag: Code:
<body{$reading_direction_tag}{if $body_onload ne ''} onload="javascript: MM_preloadImages('../../template-files/2newsletter.jpg','../../template-files/2festool.jpg','../../template-files/2internetstore.jpg','../../template-files/2flitch.jpg','../../template-files/2cart_empty.gif');{$body_onload}"{/if}> When I view the page at http://www.hearnehardwoods.com/xcart/home.php?shopkey=9779 Everything works except the dropdowns for: Homepage Our Woods Internet Store Customers Contact Us and the rollovers (Dreamweaver) just above the menu and to the right (there are 4 image buttons with text on them) Everything works correctly here: http://www.hearnehardwoods.com/about_us/policies.html I'm running XCart Gold version 4.1.6 Thanks in advance, Debra |
Re: adding javascript to customer home.tpl
Your closing literal tag is wrong, it should be {/literal} not </literal>
Also, can you please update your forum signature with your X-Cart version? Thank you :) |
Re: adding javascript to customer home.tpl
thanks for looking at my coding and telling me where the error was. I've fixed that but have a new issue.
The drop down menu is is not working - the sub-menus don't expand over the Search bar, see: http://www.hearnehardwoods.com/xcart/home.php?shopkey=9779 However, the same javascript code does work here: http://www.hearnehardwoods.com/about_us/policies.html Does you have any ideas about what I could do? |
Re: adding javascript to customer home.tpl
you may want to check the folder structure since you are using "../../" and your xcart and the aboutus are different directories
|
Re: adding javascript to customer home.tpl
thanks inebriate,
I double checked my directory path statements and they are valid. To test, I created a test.js javascript file and placed it in the same folder that the drop down menu javascript file (p7popmenu.js) is, loaded the test.js w/in home.tpl (exactly as I did for p7popmenu.js) and called for the function (contained in the test.js file) in head.tpl and it works. Whereas calling for the function contained in the p7popmenu.js in the head.tpl does not work. I also tried put the actual javascript for the drop down menu into the home.tpl but that also did not work. This is the "preview" of my head.tpl, at the top you can see the date modified that is generated by test.js, just below the banner images, you can see my drop down menu (this is what it would look like in a non-css compatible browser) -- don't know if that helps anything, but here;s the link: http://www.hearnehardwoods.com/xcart/test.gif http://www.hearnehardwoods.com/xcart/test.gif |
Re: adding javascript to customer home.tpl
Found the problem - it has to do with how my "<body onload" coding was done.
The correct code order is: Code:
<body onload="P7_initPM(1,0,1,0,0);MM_preloadImages('../../template-files/2newsletter.jpg','../../template-files/2festool.jpg','../../template-files/2internetstore.jpg','../../template-files/2flitch.jpg','../../template-files/2cart_empty.gif')"{$reading_direction_tag}{if $body_onload ne ''} {$body_onload} {/if}> |
All times are GMT -8. The time now is 05:42 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.