| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
javaScript in product.tpl | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() What I'm trying to acheive is a small pop up window when someone clicks on a link from within the detailed description... using javaScript
The script is <script language="JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> and the link is <a href="javascript:;" onClick="MM_openBrWindow('/myImageFile.jpg','template','width=400,height=600) "> I've tried putting the script and the link in the Detailed Description but that doesnt work. I've tried putting the script in product.tpl and the link in Detailed Description but that doesnt work. Help please.....
__________________
Sharon vers. gold 4.0.17 to 4.1.10 (july 2008 ) |
|||||||
#2
|
|||||||
|
|||||||
![]() You need to use {literal} tags around JS:
{literal} Javascript here {/literal}
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#3
|
|||||||
|
|||||||
![]() I appreciate your help throughout this forum ... but I'm afraid I need to be walked through this
I've tried the literal tags and I still cannot get it to work. Would you mind spelling it out for me? Hopefully others can benefit from this too. Do I put the script in the detailed description or the product.tpl I tried putting this at the top of the detailed description but it doesnt work. {script language="JavaScript"} <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> {/script} and this as my link <a href="javascript:;" onClick="MM_openBrWindow('/myImageFile.jpg','template','width=400,height=600) ">
__________________
Sharon vers. gold 4.0.17 to 4.1.10 (july 2008 ) |
|||||||
#4
|
|||||||
|
|||||||
![]() You can't add javascript to a detailed descripotion, you need to add it to product.tpl, but that may need to go in the <head> tag, which means customer/home.tpl.
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#5
|
|||||||
|
|||||||
![]() I'm surprised this is not as easy as I thought it would be.
It's not working. I've put the following code in the <head> tag of customer/home.tpl and i tried main/product.tpl but it doesnt work {script language="JavaScript"} <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> {/script} When I view my page, it says at the bottom of the browser window "Done, but with errors on page" and nothing happens when I click on the link. The code I'm using inside Detailed Description is <a href="javascript:;" onClick="MM_openBrWindow('/myImageFile.jpg','template','width=400,height=600) "> I really hesitate to use X-cart support points on this. any other ideas or should I give up? or is there another way to use pop-up windows from within the detailed description?
__________________
Sharon vers. gold 4.0.17 to 4.1.10 (july 2008 ) |
|||||||
#6
|
|||||||
|
|||||||
![]() Again, you need literal tags, and you have the js wrong. It should look like this:
<script language="JavaScript"> {literal} <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> {/literal} </script>
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#7
|
|||||||
|
|||||||
![]() that doesnt work either.
As I mentioned, I'm really new to this and really struggling. thanks for your time. I'm giving up. ![]()
__________________
Sharon vers. gold 4.0.17 to 4.1.10 (july 2008 ) |
|||||||
#8
|
|||||||
|
|||||||
![]() No need to give up...you'll never understand this cart if you do that
![]() Try this...open up common.js and add this to the very bottom: function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } Then see if your pop-up link works. The image may not load, but see if you at least get the pop-up.
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
#9
|
|||||||
|
|||||||
![]() No I dont get the pop up.
I added the script in home.tpl and product.tpl and added the code to the very bottom of common.js I'm sure I can use js in the detailed description ... because from the wysiwyg editor they have javascript as an option in the link pull down menu. and I've stared and stared at this but the link syntax looks correct to me: <a href="javascript: onClick=&quot;MM_openBrWindow('/myImageFile.jpg','template','width=400,height=600) ">WORK DARN YOU</a>
__________________
Sharon vers. gold 4.0.17 to 4.1.10 (july 2008 ) |
|||||||
#10
|
|||||||
|
|||||||
![]() Are you getting JavaScript errors?
__________________
Padraic Ryan Ryan Design Studio Professional E-Commerce Development |
|||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|