title: hover to div to change other element's style
body: <p>I create an div and a list of anchor.</p>
  
  <pre><code>&lt;div id="wrap"&gt;
  &lt;div id="box1"&gt;&lt;/div&gt;
  &lt;div id="box2"&gt;&lt;/div&gt;
  &lt;ul&gt;
   &lt;li&gt;&lt;a href=".." id="a1"&gt;text1&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href=".." id="a2"&gt;text2&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>my goal is when I mouseover the <code>box1</code> the <code>a1</code> will change the text color and when it mouseout it will back to the normal color.</p>
  
  <p>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 <code>box1</code> the <code>a1</code> will change the color to red but when I mouseout, it will not change to blue, it will remain in red.</p>
  
  <p>this mycode look like:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  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";
  }
  &lt;/script&gt;
  &lt;style&gt;
  a{color:red;}
  a:hover{color:blue;}
  .box{min-height: 180px;width: 220px;position: absolute;cursor: pointer;}
  &lt;/style&gt;
      &lt;div id="wrap"&gt;
      &lt;div class="box" id="box1" onmouseover="mouseoverBox1()" onmouseout="onmouseoutBox1()" &gt;&lt;/div&gt;
      &lt;div class="box"  id="box2" onmouseover="mouseoverBox2()" onmouseout="onmouseoutBox2()"&gt;&lt;/div&gt;
      &lt;ul&gt;
       &lt;li&gt;&lt;a href=".." id="a1"&gt;text1&lt;/a&gt;&lt;/li&gt;
       &lt;li&gt;&lt;a href=".." id="a2"&gt;text2&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>does anyone have an idea about my case? </p>
  
  <p>any help will be appreciated. Thanks</p>