Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

Need this div tag

http://www.microsoft.com/windowsmobile/communities/smartphone/default.mspx

on top you have quick links.

I want a similar ability to show list of all of my products when some one takes mouse over or clicks.

0
tgatif
Asked:
tgatif
1 Solution
 
tgatifAuthor Commented:
sumthing else
0
 
tgatifAuthor Commented:
still not this. something exact similar to what ms has.
0
 
ThijsSCommented:
<html>

<head>
      <script>
      
      function findPos(obj)
      {
            var curleft = curtop = 0;
            if (obj.offsetParent)
            {
                  curleft = obj.offsetLeft
                  curtop = obj.offsetTop
                  while (obj = obj.offsetParent)
                  {
                        curleft += obj.offsetLeft
                        curtop += obj.offsetTop
                  }
            }
            
            return [curleft,curtop];
      }
      
      function HideDiv(e)
      {
            var TheDivToBeRemoved = document.getElementById("RemoveMe");
            TheDivToBeRemoved.parentElement.removeChild(TheDivToBeRemoved);
      }
      
      function ShowDiv()
      {
            if(document.getElementById("RemoveMe")==null)
            {
                  var TheDiv = document.createElement("DIV");
                  var TheLink = document.getElementById("TheLink");
                  document.body.appendChild(TheDiv);
                  TheDiv.innerHTML = "<p>Anything You want!</p>"
                  TheDiv.id = "RemoveMe";
                  TheDiv.style.border = "2px solid gray";
                  TheDiv.style.background = "white";
                  TheDiv.style.position = "absolute";
                  TheDiv.style.left = findPos(TheLink)[0] + "px";
                  TheDiv.style.top = findPos(TheLink)[1] + "px";
                  TheDiv.style.height = "100px";
                  TheDiv.style.width = "200px";
                  TheDiv.onmouseleave = HideDiv;
            }
      }
      
      </script>

</head>

<body>

<a id="TheLink" onMouseOver="ShowDiv();" href="somewhere">Quick Links</a>

</body>

</html>

The popup-div is fully custumizable in the "ShowDiv" function.
To get a nice layout within the DIV, you might want to use a table.

example:
TheDiv.innerHTML = "<table><tr><td>Product 1</td><td>Product 2</td></tr><tr><td>Product 3</td><td>Product 4</td></tr></table>";
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now