zoukankan      html  css  js  c++  java
  • jQuery的(IE,Chrome)浏览器的兼容性问题

         jQquery是一个优秀的Javascrīpt框架,将javascript的复杂的dom编程简单化,条理化,兼容化。大家都知道在主流浏览器去中(IE,Chrome,FireFox)javascript存在很大的兼容问题,所以如果遇到一个兼容问题的话,你需要把所有的浏览器考虑在内,这样加重了编程了负担,使前台编程复杂化,但是jQuery可以解决很多类似的问题,但是今天遇到了一个jQuery兼容的问题,所以把源码公布出来,供大家参考。

    <!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>
    <title></title>
    <script src="js/jquery-1.9.1.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(function () {

      $("input[name=rj]").click(function () {

        $(this).css("backgroundColor", "Blue");
        $(this).siblings().css("backgroundColor", "inherit");
      }); //IE,Chrome不兼容

    });

    </script>
    </head>
    <body>

      <input id="Radio1" type="radio" name="rj"/>计算机<br/>
      <input id="Radio2" type="radio" name="rj"/>英语<br/>
      <input id="Radio3" type="radio" name="rj"/>日语<br/>
      <input id="Radio4" type="radio" name="rj"/>法语<br/>
      <input id="Radio5" type="radio" name="rj"/>俄语<br/>
      <input id="Radio6" type="radio" name="rj"/>德语<br/>
      <input id="Radio7" type="radio" name="rj"/>西班牙语<br/>

    </body>

    </html>

  • 相关阅读:
    C++解决单纯形表
    VS2010 MFC Excel(3)
    VS2010 MFC Excel(1)
    VS2010 MFC 读取Excel(2)
    读取数量不定的输入数据
    牛顿插值
    连接数据库
    雅克比迭代
    NOIP模拟 24
    NOIP模拟 23
  • 原文地址:https://www.cnblogs.com/myhappylife/p/3079631.html
Copyright © 2011-2022 走看看