国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery實現的點擊按鈕改變樣式功能示例

2019-11-19 13:26:20
字體:
來源:轉載
供稿:網友

本文實例講述了jQuery實現的點擊按鈕改變樣式功能。分享給大家供大家參考,具體如下:

1. css代碼:index4.css

@CHARSET "UTF-8";.sd{  font-weight: bold;  color: black;  background: red;}

2. jsp代碼:index4.jsp

<%@ page language="java" import="java.util.*"pageEncoding="UTF-8"%><%Stringpath = request.getContextPath();StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN"><html> <head>  <base href="<%=basePath%>" rel="external nofollow" >  <title>My JSP 'index4.jsp' startingpage</title>  <meta http-equiv="pragma"content="no-cache">  <meta http-equiv="cache-control"content="no-cache">  <meta http-equiv="expires"content="0">  <meta http-equiv="keywords"content="keyword1,keyword2,keyword3">  <meta http-equiv="description"content="This is my page">  <link rel="stylesheet"type="text/css" href="css/index4.css" rel="external nofollow" >  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>  </head>  <body> <table width="428"height="148" border="1"align="center" id="table"> <tr> <td><div align="center"> <label><input type="button"name="Submit" value="添加樣式" onclick="clicks()"/></label> <label><input type="button"name="Submit2" value="移除樣式" onclick="removeClicks()"/></label></div> </td> </tr> </table> <script type="text/javascript">  function clicks(){//  $("#table").toggleClass("sd");  $("#table").addClass("sd");  }  function removeClicks() {  $("#table").removeClass("sd");  } </script> </body></html>

運行效果:

感興趣的朋友可以使用在線HTML/CSS/JavaScript代碼運行工具http://tools.VeVB.COm/code/HtmlJsRun測試一下運行效果。

更多關于jQuery相關內容感興趣的讀者可查看本站專題:《jQuery頁面元素操作技巧匯總》、《jQuery常見事件用法與技巧總結》、《jQuery常用插件及用法總結》、《jQuery擴展技巧總結》、《jQuery常見經典特效匯總》及《jquery選擇器用法總結

希望本文所述對大家jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 嵊州市| 抚远县| 永胜县| 成安县| 凌海市| 太仓市| 札达县| 荆州市| 五莲县| 酉阳| 句容市| 安仁县| 堆龙德庆县| 万源市| 景洪市| 滨州市| 蒙阴县| 阿图什市| 成安县| 武义县| 广元市| 凉山| 邯郸县| 同德县| 雷波县| 洪雅县| 沾益县| 商城县| 浪卡子县| 兴业县| 望城县| 济阳县| 永安市| 方正县| 府谷县| 将乐县| 汪清县| 兴和县| 乌拉特后旗| 华亭县| 隆化县|