Page 1 of 1

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

Posted: Fri Dec 30, 2011 4:20 pm
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

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

Posted: Fri Dec 30, 2011 4:34 pm
by Gregor
Could this be the cause?
//--></__script>
I would try to remove //--> or place </__script> on a new line.

Gregor

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

Posted: Fri Jan 06, 2012 4:07 pm
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