首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

帮看看DIV弹出窗口的有关问题

2012-03-18 
帮看看DIV弹出窗口的问题我想实现鼠标经过文字时弹出个DIV窗口,并且可以选择DIV窗口中的内容,当鼠标移出DI

帮看看DIV弹出窗口的问题
我想实现鼠标经过文字时弹出个DIV窗口,并且可以选择DIV窗口中的内容,当鼠标移出DIV窗口时该DIV窗口隐藏...可是写了隐藏事件以后发现鼠标无法移到DIV窗口了,应该怎么改才行啊?

<center>
<script>
function   Workhide_Com(sname){
if(sname.style.display== 'none '){

sname.style.display= ' ';
}else{

sname.style.display= 'none ';
}
}

function   hide(sname)
{
sname.style.display= 'none ';
}
</script>
<table   width= "200 "   border= "1 ">
    <tr>
        <td> <div   onMouseOver= "Workhide_Com(Workhide_Conent) "   > show   it </div>
            <div   onMouseOut= "hide(Workhide_Conent) "       id= "Workhide_Conent "   style= "display:none;border:1px   solid   black;width:300px;height:100px;   position:absolute;   background-color:#FFFFFF ">
                <style>
a:link,a:visited{   text-decoration:   none;   color:   #ddff11   }
a:hover{   text-decoration:   underline   ;   color:   #11ef11}
a.w:link,a.w:visited{   text-decoration:   none;   color:   #fa0011   }
a.w:hover{   text-decoration:   underline   ;   color:   #11adef}
</style>
                <a   href= "http://www.yahoo.com/ "> 我很丑,但我很温柔! </a>   <a   class= "w "   href= "http://www.excite.com/ "> 醒来后我依然是我!! </a> <br>
                <a   href= "http://www.yahoo.com/ "> 我很丑,但我很温柔! </a>   <a   class= "w "   href= "http://www.excite.com/ "> 醒来后我依然是我!! </a> <br>
                <a   href= "http://www.yahoo.com/ "> 我很丑,但我很温柔! </a>   <a   class= "w "   href= "http://www.excite.com/ "> 醒来后我依然是我!! </a> <br>
            </div> </td>
        <td> &nbsp; </td>
        <td> &nbsp; </td>
    </tr>
    <tr>
        <td> </td>
        <td> &nbsp; </td>
        <td> &nbsp; </td>
    </tr>
    <tr>
        <td> &nbsp; </td>
        <td> &nbsp; </td>
        <td> &nbsp; </td>
    </tr>
</table>


[解决办法]
<center>
<script>
function Workhide_Com(sname){
if(sname.style.display== 'none '){

sname.style.display= ' ';

}else{

sname.style.display= 'none ';
}
}

function hide(sname)
{
sname.style.display= 'none ';
}
</script>
<table width= "200 " border= "1 ">
<tr>
<td> <div onMouseOver= "Workhide_Com(Workhide_Conent) " onMouseOut= "hide(Workhide_Conent) "> show it


<div id= "Workhide_Conent " style= "display:none;border:1px solid black;width:300px;height:100px; position:absolute; background-color:#FFFFFF ">

<style>
a:link,a:visited{ text-decoration: none; color: #ddff11 }
a:hover{ text-decoration: underline ; color: #11ef11}
a.w:link,a.w:visited{ text-decoration: none; color: #fa0011 }
a.w:hover{ text-decoration: underline ; color: #11adef}
</style>
<a href= "http://www.yahoo.com/ "> 我很丑,但我很温柔! </a> <a class= "w " href= "http://www.excite.com/ "> 醒来后我依然是我!! </a> <br/>
<a href= "http://www.yahoo.com/ "> 我很丑,但我很温柔! </a> <a class= "w " href= "http://www.excite.com/ "> 醒来后我依然是我!! </a> <br/>
<a href= "http://www.yahoo.com/ "> 我很丑,但我很温柔! </a> <a class= "w " href= "http://www.excite.com/ "> 醒来后我依然是我!! </a> <br/>
</div> </div> </td>
<td> &nbsp; </td>
<td> &nbsp; </td>
</tr>
<tr>
<td> </td>
<td> &nbsp; </td>
<td> &nbsp; </td>
</tr>
<tr>
<td> &nbsp; </td>
<td> &nbsp; </td>
<td> &nbsp; </td>
</tr>
</table>
[解决办法]
你把 onMouseOver= "Workhide_Com(Workhide_Conent) " 写在 <td> 里就好使了!
我试过了 LZ给分吧!
[解决办法]
ztlyz84(哈震天堂)的办法很巧妙,本来以为需要判断鼠标位置来解决的

热点排行