Support » Themes and Templates » simple swapping of image won’t work?

  • Have a div that already changes its background onmouseover and onmouseout which was done through simple CSS. Now I want to add an effect that when the div gets clicked it retains the image used onmouseover. I implemented it via javascript but I can’t seem to make it work. It only removes the default bg. Here’s my code:
    div html:

    <div id=”content_1_1″ onclick=”changeBg(”>


    function changeBg(content){
    document.getElementById(content).style.backgroundImage = “url(images/itembg_on.jpg)”;

    Any help would be greatly appreciated…

Viewing 1 replies (of 1 total)
  • Michael


    Forum Moderator

    depending on from where you call the function, the image path is probably not correct – try:

    "url(<?php bloginfo('template_url'); ?>/images/itembg_on.jpg)"

Viewing 1 replies (of 1 total)
  • The topic ‘simple swapping of image won’t work?’ is closed to new replies.