title: get id of focused element using javascript
body: <p>I have single Html page having many anchor elements. This single Html page contains many div parts. Only one part displays at time and a anchor specific to this part will focused. this html also contain a div to open popup. When this popup will open anchor specific to this will focused. Now I want get the anchor focused earlier to popup anchor focused.
  My code is following:-</p>
  
  <pre><code>&lt;body onload="Main.onLoad();" onunload="Main.onUnload();"&gt;
  
          &lt;a href='javascript:void(0);' id='anchor' onkeydown='Main.MainKeyHandler();'&gt;&lt;/a&gt;
          &lt;a href='javascript:void(0);' id='anchorAboutUs' onkeydown='Main.MainKeyHandler1();'&gt;&lt;/a&gt;
          &lt;a href='javascript:void(0);' id='anchorSecondScreen' onkeydown='Main.MainKeyHandler2();'&gt;&lt;/a&gt;
          &lt;a href='javascript:void(0);' id='popupanchor' onkeydown='PopupKeyHandler();'&gt;&lt;/a&gt;
          &lt;div id="ParentDiv"&gt;
              &lt;div id="SplashScreenDiv"&gt;
                  &lt;div id="SplashScreen"&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div id="Logo"&gt;&lt;/div&gt;
              &lt;div id="Header"&gt;&lt;/div&gt;
              &lt;div  id='messagePopup'  style='position:relative;width:500px;z-index:1000;background-color:#ffffff;'&gt;&lt;div &gt;&lt;/div &gt;&lt;div id='popupReturn'&gt;Return&lt;/div&gt;&lt;div&gt;
              &lt;div id="PopUp"&gt;
                  &lt;div id="YesBtn"&gt;&lt;/div&gt;
                  &lt;div id="NoBtn"&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div id="FirstScreen"&gt;
              &lt;div id="testinfo" style="color:#ff0000; width:600px; height:50px; overflow:hidden; font-size:xx-large; "&gt;&lt;/div&gt;
                  &lt;div id="btn_horoscope"&gt;&lt;/div&gt;
                  &lt;div id="btn_aboutus"&gt;&lt;/div&gt;
              &lt;/div&gt;
              &lt;div id="AboutUsScreen" &gt;
                  &lt;div id="AboutUsImgDiv"&gt;
                      &lt;div id="AboutUsImg"&gt;&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div id="aboutUsInfoDiv"&gt;
                      &lt;div id="aboutUsInfo"&gt;&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div id="SecondScreen" &gt;
                  &lt;div id="HoroscopeImg" class="HoroImage"&gt;&lt;/div&gt;
                  &lt;div id="SelSunSignMsgDiv"&gt;
                      &lt;div id="SelSunSignMsg"&gt;Select your SunSign &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div id="SelSunSignDiv"&gt;
                      &lt;div id="SelSunSign"&gt;
                      &lt;div id="SunSign_0"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_1"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_2"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_3"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_4"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_5"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_6"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_7"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_8"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_9"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_10"&gt;&lt;/div&gt;
                      &lt;div id="SunSign_11"&gt;&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
  
  
      &lt;/body&gt;
  </code></pre>
  
  <p>any help will appriciated</p>