删除CSS文件 [英] Removing the CSS file

查看:120
本文介绍了删除CSS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用spirng MVC与jsp页面进行演示,我有三个选项卡假设 A,B C 在一个jsp页面。当点击A选项卡时,css文件(例如aa.css)已经在head标签中加载相应的div,同样的方式点击B和C.主要问题是一次 Three CSS 文件正在加载,它们会相互覆盖。此外,我要从中删除文件,点击上面的任何标签使用 jquery >

I am using spirng MVC with jsp page for presentation, i have three tab suppose A,B and C in one jsp page. While clicking on A tab the css file such as aa.css have being loading in head tag with respective div is shown and the same way on click on B and C. The main problem is once the Three .CSS file is being loaded it overwrite each other. Also i want to remove css file from head which has being loaded on click of any of above tab using jquery as shown below.

  $("#A").click(function(){
     alert("Remove bb and cc.css file form head tag");
  });

任何想法都会帮助我。

感谢。

推荐答案

id c>< link> 标记。

Give an id to the <link> tag.

<link rel="stylesheet" href="style1.css" id="style1" />
<link rel="stylesheet" href="style2.css" id="style2" />

并使用此代码

$("#A").click(function(){
    $("#style1").attr("disabled", "disabled");
});

注意:HTML标准中没有disabled属性是HTMLLinkElement DOM对象的disabled属性。

Note: While there is no disabled attribute in the HTML standard, there is a disabled attribute on the HTMLLinkElement DOM object.

禁用作为HTML属性的使用是非标准的,仅由某些Microsoft浏览器使用。不要使用它。要实现类似的效果,请使用以下方法之一:

The use of disabled as an HTML attribute is non-standard and only used by some Microsoft browsers. Do not use it. To achieve a similar effect, use one of the following techniques:


  • 如果 disabled 属性已直接添加到页面上的元素,不包括< link> 元素;

  • disabled 通过脚本编写DOM对象的属性。

  • If the disabled attribute has been added directly to the element on the page, do not include the <link> element instead;
  • Set the disabled property of the DOM object via scripting.

这篇关于删除CSS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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