在asp.net上的onmouseover [英] onmouseover in asp.net

查看:66
本文介绍了在asp.net上的onmouseover的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目要求之一是:



当我将光标放在图像按钮上时,必须突出显示。

(即必须更改按钮的边框)。

当我移出光标时,它应该是正常的。



我使用了以下代码:

One of my project requirement is:

When i place the cursor on an imagebutton, it has to be highlighted.
(i.e border of the button has to be changed).
when i move out the cursor, it should be normal.

I have used the following code:

<td>    <asp:ImageButton ID="Img14" ImageUrl="IMG/16_print.gif" onmouseover = "highlight_Img14()" onmouseout = "removehightlight_Img14()"    runat = "server"  OnclientClick = "window.open(''http://www.google.co.in'',''mywindow'',''location=0,status=0,resizable=yes,scrollbars=0,left=700,top=128,width=800px,height=900px'');" />  </td>                                  




function highlight_Img14() {

        document.getElementById("Img14").style.border = "0.5px solid yellow";

    }
    function removehightlight_Img14() {

        document.getElementById("Img14").style.border = "0px solid yellow";
    }







工作正常。唯一的问题是它旁边的图像按钮正朝着右侧移动。我尝试过使用padding = 0,position =fixed / absolute。但问题仍然没有解决。




It is working fine. Only problem is the image buttons next to it are moving towards right side. I have tried using padding = 0 , position = "fixed/absolute". But still the issue is not resolved.

推荐答案

尝试将 td 元素设置为固定的宽度。例如,如果您的按钮是140像素,请将 td 设置为150像素。这应留出足够的空间来绘制边框。
Try setting the td element to a fixed Width. For example if your button is 140 pixels, set your td to 150 pixels. This should leave enough room for the border to be drawn.


这篇关于在asp.net上的onmouseover的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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