代码在Internet浏览器中工作,但在chrome,mozilla中没有。问题是什么? [英] Code working in Internet exploler but not in chrome,mozilla. what is the problem?

查看:124
本文介绍了代码在Internet浏览器中工作,但在chrome,mozilla中没有。问题是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">

       $(document).ready(function () {

           $('#B').click(function () {


               if ($.browser.msie) {

                   alert("IE");
                   $('#info').css("background-color","yellow !important");
                   //alert("IE");
               }
               else if ($.browser.webkit) {
                   alert("Webkit");
                   $('#info').css("backgroundColor", "pink !important");

               }
               else if ($.browser.mozilla) {

                   alert("Mozilla");
                   $('#info').css("backgroundColor", "orange !important");
               }
               else {

                   alert("unknown");
               }



           });




       });

   </script>


   <div id="info"></div>

   <input  id="B" type="button" value="See Effect" />



推荐答案

(document).ready(function(){
(document).ready(function () {


('#B')。click(function(){


if(
('#B').click(function () { if (


。 browser.msie){

alert(IE);
.browser.msie) { alert("IE");


这篇关于代码在Internet浏览器中工作,但在chrome,mozilla中没有。问题是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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