浏览器与IE和Firefox的兼容性,用于设计的chrome和JavaScript的兼容性 [英] Browser compatibility with IE and Firefox, chrome for design and JavaScript compatibility

查看:138
本文介绍了浏览器与IE和Firefox的兼容性,用于设计的chrome和JavaScript的兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在使用Asp.net Web应用程序,它给了一些问题.这些具有视觉外观和JavaScript.

问题出在IE7中:我正在应用程序中使用菜单控件,但是当我在IE7中浏览时,菜单不支持该功能

表示菜单不可见.

Firefox浏览器的问题是:当我单击Textbox/DropDownList时,我们必须填充一个显示
的Confirmbox
消息您要更改值?"

然后,当我们单击确定"按钮时,它将打开下拉列表或允许在IE和chrome中的文本"框中写入文本,但不能在FireFox中写入文本

JavaScript如下

Hi All

i am working with Asp.net web application in this it is giving some problems. those are with visual appearance and JavaScript.

The problems are in the IE7: i am using the menu control in the application but when i browse in the IE7 the menus are not supporting that

means the menus are not visible.

problem with Firefox browser is : when i am clicking on the Textbox/DropDownList we have to populate an confirmbox which shows an

message that "you want to change the values?"

then when we click on the ok button it will opens the drop down or allow to write text in that Text box in IE and chrome but not in FireFox

the JavaScript is as follows

function ChangeMgr(id) {

            if (!confirm("Do You want to change security level?"))

                document.getElementById(id).blur();

        }


下拉标签如下:


and the dropdown tag is as follows

<asp:DropDownList ID="ddlSecurityLevel" runat="server" OnSelectedIndexChanged="ddlSecurityLevel_SelectedIndexChanged"

                                        onfocus="ChangeMgr(id)">

     <asp:ListItem Selected="True">Preparer</asp:ListItem>
     <asp:ListItem>Office Manager</asp:ListItem>
     <asp:ListItem>Owner/Franchisor</asp:ListItem>
</asp:DropDownList>



而文本框"标签为



and the Textbox tag is

<asp:TextBox onfocus="ChangeMgr(id)" ID="txtMangerUserName" runat="server" OnTextChanged="txtMangerUserName_TextChanged"></asp:TextBox>



上面的ChangeMgrId JavaScript可以在IE和Chrome中正常运行,但不能在Firefox中运行


这些是浏览器兼容性问题,请检查并尝试解决这些问题,或者如果找到与此相关的任何链接,请发送帖子

主要要求是浏览器兼容性

如何使应用程序支持CSS和JavaScript的所有浏览器类型和版本

预先感谢所有

感谢和问候
V.S.R.克里希纳



the above ChangeMgrId JavaScript is works fine in IE and Chrome but not in Firefox


these are the browser compatibility issues please check it and try to resolve these issues or if you find any links for this please send post it

The main Requirement is browser compatibility

how to make an application support all browsers types and versions for the CSS and JavaScript

Thanks to all in advance

Thanks And Regards
V.S.R.Krishna

推荐答案



1.为了实现跨浏览器兼容性,您需要确定正在使用哪个浏览器客户端.这些浏览器(名称和版本)可以由javascript识别.请找到以下链接,该链接显示了如何使用javascript来识别浏览器.

[ http://www.quirksmode.org/js/detect.html ]

2.一旦检测到浏览器,就需要编写适当的代码以使代码在该浏览器中运行.

在您的"ChangeMgr"函数中,我猜这行"document.getElementById(id).blur();"不能按预期工作.(是的,因为我没有mozila,因此无法真正验证这一点).

您可能需要按以下方式更改逻辑

Hi,

1. For cross browser compatibility, you need to identify which browser client is using. These browser (name and version) can be identified by javascript. Please find the below link which shows how using javascript you can identify which browser it is.

[http://www.quirksmode.org/js/detect.html]

2. Once you detect the browser, then you need to write appropriate code to get your code working in that browser.

In your "ChangeMgr" function, I guess the line " document.getElementById(id).blur();" is not working as expected.(yes as I dont have mozila and hence could not actually verify that indeed ).

You might need to change the logic as following way

var browserName = GetBrowserName();
function ChangeMgr()
{
    if(browserName=="Internet Explorer")
    {
       //current code block here that you have seen working nicely in IE.
    }
    else
    {
       //write new code block to get that working in firefox
    }
}



希望对您有帮助,
:thumbsup:



Hope it helps you,
:thumbsup:


这是个好主意,但我不知道在mozilla firefox中类似于ChangeMgr的代码是什么,请帮助我如何在mozilla中编写以上代码
it is good idea but i don''t what is the code similar to ChangeMgr in the mozilla firefox please help me how to write the above code in mozilla


这篇关于浏览器与IE和Firefox的兼容性,用于设计的chrome和JavaScript的兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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