Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7492593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:28:28+00:00 2026-05-29T16:28:28+00:00

I’m beginner and write some HTML code but what I need is when I

  • 0

I’m beginner and write some HTML code but what I need is when I click on div to change background image… How I can do that?

Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
#kat1 {
    background-image:url(ikoniceKategorije/07.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat1:hover {
    background-image:url(ikoniceKategorije/07h.jpg);
    }

#kat2 {
    background-image:url(ikoniceKategorije/06.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat2:hover {
    background-image:url(ikoniceKategorije/06h.jpg);
    }

#kat3 {
    background-image:url(ikoniceKategorije/05.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat3:hover {
    background-image:url(ikoniceKategorije/05h.jpg);
    }

#kat4 {
    background-image:url(ikoniceKategorije/04.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat4:hover {
    background-image:url(ikoniceKategorije/04h.jpg);
    }
#kat5 {
    background-image:url(ikoniceKategorije/03.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat5:hover {
    background-image:url(ikoniceKategorije/03h.jpg);
    }

#kat6 {
    background-image:url(ikoniceKategorije/02.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat6:hover {
    background-image:url(ikoniceKategorije/02h.jpg);
    }

#kat7 {
    background-image:url(ikoniceKategorije/01.jpg);
    width:30px;
    height:30px;
    float:left;
    }
#kat7:hover {
    background-image:url(ikoniceKategorije/01h.jpg);
    }
#div {
    width:220px;
    height:30px;
    overflow:hidden;
    }

</style>
</head>

<body>
    <div id="div">
        <div id="kat1"></div>
        <div id="kat2"></div>
        <div id="kat3"></div>
        <div id="kat4"></div>
        <div id="kat5"></div>
        <div id="kat6"></div>
        <div id="kat7"></div>
    </div>
</body>
</html>

or you can see at on http://www.pluspon.com/kategorije.html what I plan to do. Change Image on hover and on click also… THANKS !!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:28:29+00:00Added an answer on May 29, 2026 at 4:28 pm

    Using jQuery you could do something like this:

    $(document).ready(function () {
        $("#kat1").click(function () {
            $(this).css("background-image", "xxx.png");
        });
    });
    

    If you wan´t to toggle you could do:

    $("#kat1").click(function () {
        if ($(this).css("background-image") == first_Image) {
            $(this).css("background-image", second_Image);
        }
        else {
            $(this).css("background-image", first_Image);
        } 
    });
    

    });

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.