按钮样式的添加

来源:互联网 发布:逍遥子 晓梦 知乎 编辑:程序博客网 时间:2024/05/17 07:40

1 index10.css

@CHARSET "UTF-8";

.selected{

    background: red

}

2 index10.jsp

<%@ page language="java"import="java.util.*"pageEncoding="UTF-8"%>

<%

Stringpath = request.getContextPath();

StringbasePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>

 

<!DOCTYPEHTML PUBLIC "-//W3C//DTDHTML 4.01 Transitional//EN">

<html>

  <head>

    <basehref="<%=basePath%>">

    <title>My JSP 'index4.jsp' startingpage</title>

    <metahttp-equiv="pragma"content="no-cache">

   <metahttp-equiv="cache-control"content="no-cache">

   <metahttp-equiv="expires"content="0">   

   <metahttp-equiv="keywords"content="keyword1,keyword2,keyword3">

   <metahttp-equiv="description"content="This is my page">

   <linkrel="stylesheet"type="text/css"href="css/index10.css">

   <scripttype="text/javascript"src="plug/jquery.js"></script>

   </head>

   <body>

   <tableborder="1">

   <tr>

   <td><inputtype="radio"name="radioButton"value="radioButton">小明</td>

   </tr>

   </table>

   <scripttype="text/javascript">

    $(function() {

      $("tr").click(function() {

       $(this).addClass("selected");

       });

   });

    </script>

   </body>

</html>

运行效果如下:


0 0