VS 2008不承认Onmouseover。 [英] Onmouseover is not recognized by VS 2008.

查看:111
本文介绍了VS 2008不承认Onmouseover。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到麻烦这个onmouseover,似乎我的VS 2008无法识别它。那里没有这样的事件。请帮助。

I'm having trouble with this onmouseover, it seems that my VS 2008 can't recognized it. There's no such event there. Please help.

推荐答案

You will not get  onmouseover in intellisense of VS 2008 but if you will add it manually it will work. I just tested below code.

<asp:Button ID="Button1" onmouseover="alert(1)" runat="server" Text="Button" />


查看以下示例:

check this sample below:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="onmouseover.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Onmouseover</title>
    <script type="text/javascript">
        function bigImg(x) {
            x.style.height = "270px";
            x.style.width = "500px";
        }

        function normalImg(x) {
            x.style.height = "135px";
            x.style.width = "250px";

        }

</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Image ID="Image1" runat="server" ImageUrl="~/code.gif" onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" />

<p>The function bigImg() is triggered when the user moves the mouse pointer over the image.</p>
<p>The function normalImg() is triggered when the mouse pointer is moved out of the image.</p>


    </div>
    </form>
</body>
</html>





和图片的缩略图预览 -



显示全尺寸图片鼠标悬停在ASP.NET中的缩略图 [ ^ ]





表示链接按钮:



and for your thumbnail preview of images-

Display Full Size Image on Mouse Over Thumbnail in ASP.NET[^]


for link button:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="onmouseover.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Onmouseover</title>
    <script type="text/javascript">
        function displayResult() {
            document.getElementById("p1").style.fontSize = "xx-large";
        }
        function displayResult1() {
            document.getElementById("p1").style.fontSize = "x-small";
        }


</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="p1" runat="server" onmouseover="displayResult()"

            onmouseout="displayResult1()" onclick="p1_Click"  >sample text</asp:LinkButton>





    </div>
    </form>
</body>
</html>










protected void p1_Click(object sender, EventArgs e)
       {
          Response.Redirect("~/code.gif"); // code.gif is image file included in my project. // you  can also use modalpopup/facybox to display the images from thumbnails.
       }


在div中创建一个div最初创建img标签保持div显示无。 OnMouserOver根据触发onmouseover事件的元素设置此div的坐标,现在将img src路径分配给要预览的图像,并删除不显​​示div。 OnMouseOut将div显示设置为无后退。



如果您需要进一步帮助,请与我们联系。
Create a div, inside that div create img tag keep div display none initially. OnMouserOver set the coordinates of this div based on element which fired the onmouseover event and now assign img src path to the image you want to preview and remove display none of div. OnMouseOut set div display to none back.

Please let me know if you need further assistance.


这篇关于VS 2008不承认Onmouseover。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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