[SOLVED] Pixelhaus theme and javascript->links not working

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
hdriezen
Forum Members
Forum Members
Posts: 78
Joined: Fri Dec 17, 2010 7:59 am

[SOLVED] Pixelhaus theme and javascript->links not working

Post by hdriezen »

I'm using the Pixelhaus theme and I have added a bit of javascript in the <head> of the page-template, like this:

Code: Select all

{literal}
<__script__ type="text/javascript">
function SwapImg(button,pad)
{
 var elem = document.getElementById(button);

 elem.setAttribute("src",pad);
}
//--></__script>
{/literal}
In the same page-template there's an image map which should
change when the mouse is moved over a certain part of it, like this:

Code: Select all

               <div id="bulbs">

               <img id="bulbs0" src="/uploads/bulbs.png" usemap="#bulbsmap" alt="" />
               <map name="bulbsmap" id="bulbsmap">
<area shape="rect" coords="484,210,547,311" alt="Test 1" title="Test 1" onMouseOver="SwapImg('bulbs0','/uploads/bulbs1.png');" onMouseOut="SwapImg('bulbs0','/uploads/bulbs.png');" />
</map>

               </div>
When I put the code above in the page-emplate, not a single hyperlink on the page is working anymore, including the menu. The onMouseOver-thing works fine, however.

I'm using the same script on another site without any problem, so I really don't understand why this bit of javascript interferes with the menu.

Any ideas?

Hans

CMSMS 1.10.2
Last edited by hdriezen on Wed Jan 04, 2012 11:50 am, edited 2 times in total.
User avatar
Gregor
Power Poster
Power Poster
Posts: 1874
Joined: Thu Mar 23, 2006 9:25 am

Re: Pixelhaus theme and javascript->links not working anymor

Post by Gregor »

Could this be the cause?
//--></__script>
I would try to remove //--> or place </__script> on a new line.

Gregor
hdriezen
Forum Members
Forum Members
Posts: 78
Joined: Fri Dec 17, 2010 7:59 am

Re: [SOLVED] Pixelhaus theme and javascript->links not worki

Post by hdriezen »

In the end it wasn't the script at all, I was trying to replace the div instead of the image. I was passing the id of the div to the script instead of the id of the image.

I think it is not possible to replace the image of an imagemap this way. I solved that problem by creating several smaller images.

Case closed!

Hans
Post Reply

Return to “Layout and Design (CSS & HTML)”