class样式的添加和设置.html
2024-09-01 16:48:55
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title> <script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
.redbg{
background: red;
}
.active{
color: beige;
}
</style>
</head>
<body>
<h1>helloworld</h1>
<button>黑白切换</button> <script type="text/javascript">
$('h1').addClass('redbg')
// 添加样式
$('h1').addClass('active')
// 删除样式
$('h1').removeClass('active') var isblack=true
$('button').click(function(){
// if(isblack){
// $('h1').addClass('active')
// isblack=false
// }else{
// $('h1').removeClass('active')
// isblack=true
// }
//切换样式
$('h1').toggleClass('active')
})
.css({
background:'red',
color:'skyblue'
}).html('这是一个按钮')
// $('button').css('background','red')
// $('button').html('这是个可以切换的按钮') </script>
</body>
</html>
最新文章
- SQL Server-表表达式基础回顾(二十四)
- python之最强王者(6)——列表(List)
- 在Nodejs中如何调用C#的代码
- 架构师养成记--3.synchronized细节问题
- 序列sequence中的cache问题
- servlet的九大内置对象
- phpcms v9的url优化
- session保存用户登录
- jquery.SuperSlide.2.1.2--轮播(兼容到IE7 适用于整屏)
- Jenkins进阶系列之——01使用email-ext替换Jenkins的默认邮件通知
- Rectangle Area——LeetCode
- 转:ASCII码表_全_完整版
- 优秀的电商平台Jshop栗子
- visual studio vode 汉化
- 牛客网-2018年湘潭大学程序设计竞赛-F
- react-native-vector-icons 图标库使用
- Servlet Life Cycle
- chrome浏览器访问Google的插件“谷歌访问插件”以及常用插件
- CentOS下Crontab安装使用详细说明(转)
- java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder