`
nannan408
  • 浏览: 1751329 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

jquery1.7例子2-如何在script中修改标签样式

 
阅读更多
1.前言.
   script可以先在标签的样式中加入“被选中”,“被点击”等的处理方案,然后在script中调用这种方案,实现修改标签样式。
2.例子.
 
<!DOCTYPE html>
<html>
<head>
  <style>
  p { margin: 8px; font-size:16px; }
  .selected { color:red; }
  .highlight { background:yellow; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
  Hello

  and

  Goodbye

script配合style一起实现在script修改样式。
<script>
  $("p:last").addClass("selected highlight");
 </script>

</body>
</html>
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics