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 8706059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:31:10+00:00 2026-06-13T03:31:10+00:00

I create an div and a list of anchor. <div id=wrap> <div id=box1></div> <div

  • 0

I create an div and a list of anchor.

<div id="wrap">
<div id="box1"></div>
<div id="box2"></div>
<ul>
 <li><a href=".." id="a1">text1</a></li>
 <li><a href=".." id="a2">text2</a></li>
</ul>
</div>

my goal is when I mouseover the box1 the a1 will change the text color and when it mouseout it will back to the normal color.

I have try to do this using javascript but the problem is when I mouseover the one of the div box, for example I mouseover the box1 the a1 will change the color to red but when I mouseout, it will not change to blue, it will remain in red.

this mycode look like:

<script type="text/javascript">
function mouseoverBox1(){
    var myPara = document.getElementById("a1");
    myPara.style.color = "red";
}
function onmouseoutBox1(){
    var myPara = document.getElementById("a1");
    myPara.style.color = "blue";
}
function mouseoverBox21(){
    var myPara = document.getElementById("a2");
    myPara.style.color = "red";
}
function onmouseoutBox2(){
    var myPara = document.getElementById("a2");
    myPara.style.color = "blue";
}
</script>
<style>
a{color:red;}
a:hover{color:blue;}
.box{min-height: 180px;width: 220px;position: absolute;cursor: pointer;}
</style>
    <div id="wrap">
    <div class="box" id="box1" onmouseover="mouseoverBox1()" onmouseout="onmouseoutBox1()" ></div>
    <div class="box"  id="box2" onmouseover="mouseoverBox2()" onmouseout="onmouseoutBox2()"></div>
    <ul>
     <li><a href=".." id="a1">text1</a></li>
     <li><a href=".." id="a2">text2</a></li>
    </ul>
    </div>

does anyone have an idea about my case?

any help will be appreciated. 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-06-13T03:31:11+00:00Added an answer on June 13, 2026 at 3:31 am
    <script type="text/javascript">
    function mouseoverBox1(){
        var myPara = document.getElementById("a1");
        myPara.style.color = "red";
    }
    function onmouseoutBox1(){
        var myPara = document.getElementById("a1");
        myPara.style.color = "blue";
    }
    function mouseoverBox2(){
        var myPara = document.getElementById("a2");
        myPara.style.color = "red";
    }
    function onmouseoutBox2(){
        var myPara = document.getElementById("a2");
        myPara.style.color = "blue";
    }
    </script>
    <style>
    a{color:red;}
    a:hover{color:blue;}
    </style>
        <div id="wrap">
        <div id="box1" onmouseover="mouseoverBox1()" onmouseout="onmouseoutBox1()">deve</div>
        <div id="box2" onmouseover="mouseoverBox2()" onmouseout="onmouseoutBox2()">deve</div>
        <ul>
         <li><a href="#" id="a1">text1</a></li>
         <li><a href="#" id="a2">text2</a></li>
        </ul>
        </div>​​​​​
    

    You mispelled a class name and added a quote at the end of a div tag.

    This errors are quite common if you are not experienced writing code;

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

Sidebar

Related Questions

I thought the following script will create div element but I got nothing output
I'm trying to create a new div each time a text field contained in
What I am trying to do is create a list of anchors that will
I'm looking for a way to create a scrollable DIV that does not wrap
I'm trying to create a simple markup with templates. Something like: <div class=list data-bind=template:
I have a list of href / text that I need to make anchors
I am able to create div tag dynamically but unable to create form tag
Possible Duplicate: JavaScript library to create div-style window within page I would like to
I create Any div in auto width with single image background. in act this
I need to create a DIV that has some content (some of which is

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.