在gridview中显示浮动div [英] showing floating div in a gridview

查看:230
本文介绍了在gridview中显示浮动div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个gridview,当我将鼠标悬停在某个特定的列上时,我将一个外部div(位置:绝对)加载到该位置。这是通过在gridview单元格的onmouseover事件中调用js函数完成的gvTestGrid.cells [1] .attributes.add( 的onmouseover, loadDIV();))。
我可以在鼠标悬停时正确加载div,但问题是我加载的div包含一个下拉菜单和按钮。当我尝试将鼠标移动到div中单击按钮或选择下拉列表时,div移开。发生此事后,我添加了
onmouseout事件(gvTestGrid.cells [1] .attributes.add(onmouseout ,removeDIV();))



没有onmouse事件我的div将保持加载在gridview cell.Please帮助



我做了一个小样本 $ b

 < HTML> 
< div id =divPopuponmouseout =removeDIV(this,event);风格= 显示:无;宽度:100像素;高度:100像素;颜色:深蓝色;边界:2px的;边框颜色:红;边框样式:固体; >
是它的
< / div>

< table>
< tr>< td> A< / td>< / tr>
< tr>< td> S< / td>< / tr>
< tr>< td onmouseover =loadDIV(event)onm​​ouseout =removeDIV(this,event);> D< / td>< / tr>
< tr>< td> E< / td>< / tr>
< / table>

< / html>
< script language =javascripttype =text / javascript>
函数loadDIV(evt)
{
var myWin = document.getElementById('divPopup');
myWin.style.position ='绝对';
myWin.style.left = evt.x;
myWin.style.top = evt.y;
myWin.style.display ='block';


$ b函数removeDIV(obj,evt)
{
var myWin = document.getElementById('divPopup');
myWin.style.display ='none';
myWin.style.left = 0;
myWin.style.top = 0;
}
< / script>

如果您尝试将鼠标移入div,它将移开。

解决方案

如何在完成DIV中的工作后删除div?所以当你点击DIV中的按钮(假设它工作并且应该在之后关闭)或者以类似的方式时,你可以关闭DIV。


I have a gridview and when i mouse hover on a particular column, i am loading an external div(position:absolute) into that position.This i have done by calling a js function in the onmouseover event of the gridview cell(gvTestGrid.cells[1].attributes.add("onmouseover","loadDIV();")). I am able to load the div properly on mouse hover, but the problem is my loaded div contains a dropdown and button inside it. when i try to move my mouse inside the div to click the button or select the dropdown list, the div moves away.This happens after i added onmouseout event(gvTestGrid.cells[1].attributes.add("onmouseout","removeDIV();"))

without onmouse out event my div will remain loaded there on the gridview cell.Please help

i have done a small sample

<html>
  <div id="divPopup" onmouseout="removeDIV(this,event);" style="display:none;width:100px;height:100px;color:Navy;border:2px;border-color:Red;border-style:solid;">
    Yes its me
    </div>

    <table>
    <tr><td>A</td></tr>
    <tr><td>S</td></tr>
    <tr><td onmouseover="loadDIV(event)" onmouseout="removeDIV(this,event);">D</td></tr>
    <tr><td>E</td></tr>
    </table>

</html>
<script language="javascript" type="text/javascript">
function loadDIV(evt)
{
var myWin = document.getElementById('divPopup');
myWin.style.position='absolute';
myWin.style.left = evt.x;
myWin.style.top = evt.y;
myWin.style.display='block';

}

function removeDIV(obj,evt)
{
var myWin = document.getElementById('divPopup');
myWin.style.display='none';
myWin.style.left = 0;
myWin.style.top = 0;
}
</script>

if you try to enter mouse into the div it will move away.Any solution for this please??

解决方案

How about removing the div after you are done with the work in the DIV you have popped up? So you would close the DIV when you click the button in the DIV (Assuming it does work and should close afterward) or in a similar manner.

这篇关于在gridview中显示浮动div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆