javascript鼠标悬浮出现二维码

    <div id="Layer1" style="display: none; position: absolute; z-index: 100;box-shadow: 6px 6px 4px #888888;">
    div>
      <li><a href="#" onmouseout="hiddenPic();" onmousemove="showPic(event,'assets/img/login_chat.png');">百度a>li>
    <script language="javascript">
       function showPic(e,sUrl){
          var x,y;
          x = e.clientX;
          y = e.clientY;
          //此处图片出现位置可自行调整
          document.getElementById("Layer1").style.left = x-70+'px';
          document.getElementById("Layer1").style.top = y-175+'px';
          document.getElementById("Layer1").innerHTML = " + sUrl + "\">";
          document.getElementById("Layer1").style.display = "";
       }
       function hiddenPic(){
          document.getElementById("Layer1").innerHTML = "";
          document.getElementById("Layer1").style.display = "none";
       }
    script>

你可能感兴趣的:(javascript的应用)