1

为什么 jquery 在 Opera 和 Chrome 中不起作用?

 <script language="JavaScript">
     $('link[href="includes/styles.css"]').attr("href", "includes/new_styles.css");
     $('link[href="includes/jmesa/jmesa.css"]').attr("href", "includes/jmesa/new_jmesa.css");   
 </script>
4

2 回答 2

1

试试这个doc ready:http: //jsfiddle.net/YRC4N/

$(function(){
   $('link[href$="styles.css"]').attr("href", "includes/new_styles.css");
   $('link[href$="jmesa.css"]').attr("href", "includes/jmesa/new_jmesa.css");

   $('link').each(function () {
      console.log($(this).attr('href'));
   });
});
于 2013-02-15T09:06:00.647 回答
0

尝试:

<script language="JavaScript">
 $('link[href*="includes/styles.css"]').attr("href", "includes/new_styles.css");
 $('link[href*="includes/jmesa/jmesa.css"]').attr("href", "includes/jmesa/new_jmesa.css");   
 </script>
于 2013-02-15T09:01:28.933 回答