Google Chrome浏览器中的"asp菜单"控件无法正确显示. [英] Asp Menu control in Google Chrome does not display properly.

查看:105
本文介绍了Google Chrome浏览器中的"asp菜单"控件无法正确显示.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用修改后的ASP菜单控件创建了一个小示例.我添加了一些JavaScript,这些菜单将在菜单上的mouseOver时更改菜单的背景图像.如果我们在Internet Explorer中查看,则显示效果非常好.如果我们在Google Chrome浏览器中查看该页面,则该页面不会在mouseOver上显示任何图像.它甚至以失真的方式显示.可以在这里看到工作示例.

http://aspspider.info/iamIndynos/ [ ^ ]

如果以前有人遇到过此问题,请帮助我解决此问题. Google Chrome浏览器有什么问题吗?

在此先感谢.

I have created a small sample with a modified ASP menu control. I have added some JavaScript that will change the background image of my menu when mouseOver on menu. If we view in Internet Explorer, it is displaying very good. If we view the page in Google Chrome browser, it is not showing any image on mouseOver. It is even displayed in a distorted manner. The working example can be seen here.

http://aspspider.info/iamIndynos/[^]

If anyone has had this issue before, please help me to solve this problem. Is there any problem with Google Chrome??

Thanks in advance.

推荐答案

只需添加更多代码..
我的JavaScript在这里:

just adding some more codes..
My JavaScript is here:

.myStyle
{
     background-image: url('Buttons/buttonBackground.png');
     
}
 .myStyle1
{
     background-image: url('Buttons/menuBack.png');
}



我的菜单在这里......



And my menu is here ......

<asp:Menu ID="Menu2" runat="server">
                                    <StaticSelectedStyle CssClass="myStyle1" />
                            <StaticMenuItemStyle CssClass="myStyle" ForeColor="Yellow" HorizontalPadding="5px" VerticalPadding="2px" 

                                BackColor="#F3F3EE" />
                            <DynamicHoverStyle CssClass="myStyle" BackColor="#CC00CC" ForeColor="White" />
                            <DynamicSelectedStyle BackColor="#CC00CC" />
                            <DynamicMenuItemStyle CssClass="myStyle1"  HorizontalPadding="5px" VerticalPadding="2px" 

                                BackColor="#F3F3EE" />
                            <StaticHoverStyle CssClass="myStyle1" ForeColor="White" />
                                        <Items>
<asp:MenuItem Text="Choose One to Check " Value="Choose One to Kill"></asp:MenuItem>
                                            <asp:MenuItem Text="link For Asem __" Value="New Item"></asp:MenuItem>
                                            <asp:MenuItem Text="link For  Peter __" Value="New Item"></asp:MenuItem>
                                            <asp:MenuItem Text="link For  SanKar __" Value="New Item"></asp:MenuItem>
                                            <asp:MenuItem Text="link For  Baby __" Value="New Item"></asp:MenuItem>
                                            <asp:MenuItem Text="link For  All __" Value="New Item"></asp:MenuItem>
                                        </Items>
                                    </asp:Menu>


protected void Page_PreInit(object sender, EventArgs e)
{
    // This is necessary because Safari and Chrome browsers don''t display the Menu control correctly.
    // All webpages displaying an ASP.NET menu control must inherit this class.
    if (Request.ServerVariables["http_user_agent"].IndexOf("Safari",StringComparison.CurrentCultureIgnoreCase) != -1)
               Page.ClientTarget = "uplevel";
}



希望这对您有帮助...:)



Hope this may help u... :)


添加此代码后,它对所有浏览器都有效
After adding this one it''s work for all browsers
if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
{
Request.Browser.Adapters.Clear();
}


对于IE8 ...
在StyleSheet中添加CSS专业知识


for IE8...
Add css Proferty in StyleSheet

.IE8Fix
{
    z-index: 1000;
}


并按如下所示添加css属性...


and add the css property as follows...

<asp:Menu runat="server" >
  <DynamicMenuStyle CssClass="IE8Fix" />
</asp:Menu>


这篇关于Google Chrome浏览器中的"asp菜单"控件无法正确显示.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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