比如我指到某个网页上的一个文字或者某个文字链接时,就在其旁边弹出一个浮动窗口窗口中可以有文字及图片,而且鼠标可移到浮动窗口内并拖动选取文字,鼠标移出些浮动窗口时,窗口自动消失。最好能用鼠标移动此浮动窗口到屏幕的各个角落,以免挡住其下的网页内容
请教各位js侠客,最好给出代码,我好试验一下,不胜感激!!!

解决方案 »

  1.   

    我也想实现鼠标的 onMouseOver 弹出一个浮动窗口,里面有 checkbox , radio 等....
      

  2.   

    不知道这个是否适合你,我也是从网上搜索到的,先借来一用
    <html>
    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>new page</title>
    <script type="text/javascript" language="javascript">
    function crertdiv(_parent,_element,_id,_css){//创建层
    var newObj = document.createElement(_element);
    if(_id && _id!="")newObj.id=_id;
    if(_css && _css!=""){
    newObj.setAttribute("style",_css);
    newObj.style.cssText = _css;
    }
    if(_parent && _parent!=""){
    var theObj=getobj(_parent);
    var parent = theObj.parentNode;
    if(parent.lastChild == theObj){
    theObj.appendChild(newObj);

    else{
    theObj.insertBefore(newObj, theObj.nextSibling);
    }
    }
    else document.body.appendChild(newObj);
    }function getobj(o){//获取对象
    return document.getElementById(o)
    }var swtemp=0,objtemp;
    function showdiv(inputid,inputlist){//显示层
    if (swtemp==1){getobj(objtemp+"mydiv").style.display="none";}
    var text_list=inputlist.split(",")
    if (!getobj(inputid+"mydiv")){//若尚未创建就建之
    var divcss="font-size:12px;color:#00f;position:absolute;left:"+(getobj(inputid).offsetLeft+0)+"px;top:"+(getobj(inputid).offsetTop+25)+"px;border:1px"
    crertdiv("","div",inputid+"mydiv",divcss);//创建层"mydiv"
    //alert(document.getElementById("mydiv").outerHTML)
    crertdiv(inputid+"mydiv","ul",inputid+"myul");//创建ul
    for (var i=0,j=text_list.length;i<j;i++){//创建"text_list"li
    crertdiv(inputid+"myul","li",inputid+"li"+i,"background:#fff");
    getobj(inputid+"li"+i).innerHTML=text_list[i];
    }
    crertdiv(inputid+"myul","li",inputid+"li"+j,"color:#f00;background:#fff");//创建"clear"li
    getobj(inputid+"li"+j).innerHTML="clear";
    getobj(inputid+"mydiv").innerHTML +="<style type='text/css'>#"+inputid+"mydiv ul {padding:0px;margin:0;}#"+inputid+"mydiv ul li{list-style-type:none;padding:5px;margin:0;float:left;CURSOR: pointer;}</style>"
    for (var i=0;i<=j;i++){
    getobj(inputid+"li"+i).onmouseover=function(){this.style.background="#eee";clearTimeout(timer)}
    getobj(inputid+"li"+i).onmouseout=function(){this.style.background="#fff"}
    }
    }
    var newdiv=getobj(inputid+"mydiv")
    newdiv.onclick=function(){hiddiv(event,inputid);}
    newdiv.onmouseout=function(){Mout(this)}
    newdiv.onmouseover=function(){clearTimeout(timer)}
    getobj(inputid).onmouseout=function(){Mout(newdiv)}
    newdiv.style.display="block";
    swtemp=1;
    objtemp=inputid;
    }
    var timer
    function Mout(o){
    timer=setTimeout(function(){o.style.display="none";},300)
    swtemp=0;
    }
    function hiddiv(e,inputid){
        e=e||window.event;
        ev=e.target||e.srcElement;
        v=ev.innerText||ev.textContent;
        if (v!="clear")getobj(inputid).value=v;else getobj(inputid).value=""
    getobj(inputid+"mydiv").style.display="none";
    }
    </script>
    </head>
    <body>
    <input type="hidden" value="点击,弹出,显示,消失,实现" id="list">
    利用隐藏域值赋值(onmouseover).....<input id="mytext3" type="text" onmouseover="showdiv(this.id,getobj('list').value)"/>
    </body>
    </html>
      

  3.   

    jquery 的插件 thickbox
    可以实现
      

  4.   

    http://www.cnblogs.com/hxling/archive/2009/05/20/1468817.html
    这是示例图片 可以浮动在网页上层
      

  5.   

    http://jqueryui.com/demos/draggable/#handle
      

  6.   

    你都知道网页上有这种效果,大多数情况,你都可以直接在你看到的网页上找到答案呀。这种效果一般都是JS做的,查看它网页的源代码,找到它的JS代码一看就明白了。如果当前的源代码中没找到对应的代码或函数。那就注意它的包含文件,根据包含文件的路径,在网址中输入网址,可以直接下载到.JS格式的文件,然后继续查找。这种方法可以学到很多你想要的JS代码。