![]() |
Problem adding javascript to category description
I want to add a link to a category description that will open a new window with a specific size and at the top right of the users screen. Here is the script:
Code:
<script type="text/javascript"> Here is the code that applies the javascript to the link: Code:
<a href="javascript: void(0)" onclick="popup('URL')">Click here</a> How can I add this javascript to a category? |
Re: Problem adding javascript to category description
The easiest thing to do is to add it to skin1/common.js - then it will be available to any page that calls common.js - which I think may be every page on 4.1.x (if you do this, remove the <script> and </script>)
If you only want to call it on the category pages - you can add it to skin/1/customer/home.tpl with an if/than statement to only use it when you want it. If you add it to a template, be sure to surround it with {literal} and {/literal} tags. |
Re: Problem adding javascript to category description
Adding the javascript to common.js worked perfectly:D
Thanks for the help. |
Re: Problem adding javascript to category description
Quote:
I have the same issue and wan to apply this fix. What exactly am I adding to common.js? The whole code that I'm trying to use on the page? |
Re: Problem adding javascript to category description
This is my code for having an image with a mouseover area (map). Which part do I add to common.js?
Quote:
|
Re: Problem adding javascript to category description
ah! think i got it. thanks guys!
|
Re: Problem adding javascript to category description
Ok so this isn't working on this part. I put the following into skin1/common.js
Quote:
and here's how I call it on the page Quote:
|
Re: Problem adding javascript to category description
When the page is loaded in the browser, is everything intact? What I mean, is all the code reaching the browser? Can you inspect element and see all your code?
|
Re: Problem adding javascript to category description
Yes all the code is intact on the live end. The action works when the script is on the page (offsite) but when it's only in common.js, it doesn't seem to do anything.
It worked with mouseover swap images but it's not working with swap divs. |
Re: Problem adding javascript to category description
Oh this is embarrassing - I was uploading the unchanged version of common.js. Works now!
|
All times are GMT -8. The time now is 01:37 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.