jQuery设置文字样式
来源:互联网 发布:常熟淘宝拍卖 编辑:程序博客网 时间:2024/05/22 12:48
<!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>
<style type="text/css">
p
{
background-color:#eee; font-size:30px;
}
.classadd
{
font-weight:bold; font-family:微软雅黑; font-size:40px; background-color:Green;
}
.classadd1
{
background-color:Red;
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnclass').click(function () {
$('p').css('background-color', 'blue');//设置样式
})
$('#btnAdd').click(function () {
$('p').addClass('classadd classadd1');//添加样式
})
$('#btnRemove').click(function () {
$('p').removeClass('classadd1'); //删除指定名称的样式
})
$('#btnChange').click(function () {
$('p').toggleClass('classadd1');
})
})
</script>
</head>
<body>
<p class="classadd">得用汉字</p>
<input type="button" id="btnclass" value="设置样式" />
<input type="button" id="btnAdd" value="添加样式" />
<input type="button" id="btnRemove" value="删除样式" />
<input type="button" id="btnChange" value="切换样式" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
p
{
background-color:#eee; font-size:30px;
}
.classadd
{
font-weight:bold; font-family:微软雅黑; font-size:40px; background-color:Green;
}
.classadd1
{
background-color:Red;
}
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('#btnclass').click(function () {
$('p').css('background-color', 'blue');//设置样式
})
$('#btnAdd').click(function () {
$('p').addClass('classadd classadd1');//添加样式
})
$('#btnRemove').click(function () {
$('p').removeClass('classadd1'); //删除指定名称的样式
})
$('#btnChange').click(function () {
$('p').toggleClass('classadd1');
})
})
</script>
</head>
<body>
<p class="classadd">得用汉字</p>
<input type="button" id="btnclass" value="设置样式" />
<input type="button" id="btnAdd" value="添加样式" />
<input type="button" id="btnRemove" value="删除样式" />
<input type="button" id="btnChange" value="切换样式" />
</body>
</html>
- jQuery设置文字样式
- android 设置文字样式
- Highcharts 设置坐标轴文字样式
- JQuery 设置样式属性
- 设置文字样式并写入CAD
- 【译】样式研究:设置易读的文字
- Android TextView设置部分文字样式
- 使用SpannableString设置TextView文字样式
- CSS设置字体和文字样式
- android中设置textview文字样式
- 同一个textview设置不同文字样式
- <span>标签,为文字设置单独样式
- Textview设置文字样式和颜色
- HTML5的段落和文字样式设置
- css样式——文字设置
- JQuery样式与属性设置
- UITextField常用属性:文本框样式、文字样式、键盘样式、左右视图样式、清除按钮设置等
- Jquery设置下拉列表文字跳转
- 面向对象-对象通俗解释[Objective-C代码]
- android基础知识02——线程安全3:Message,MessageQueue,Handler,Looper
- ssh不使用密码登录Linux服务器
- vbaj中传递参数值方式,值传递和引用传递
- saltstack官方文档——The Top File
- jQuery设置文字样式
- PHP递归删除指定目录下的文件和目录
- iPhone开发——在tableViewTable中创建tableCell,不同分区含有不同数量的Cell
- 分割字符串 strtok(多个字符分割)
- (小说)疯狂的程序员
- Validate Binary Search Tree
- android基础知识02——线程安全4:HandlerThread
- SystemUI 概述
- Windows的对话框