<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"><title>JQuery DEMO</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="styles.css">
-->
<style type="text/css">
div{
width:250px;
height:100px;
border:1px solid black;
float:left;
padding:10px;
}
span{
margin:3px;
border:1px solid black;
padding:5px;
}
h1,h2{
display:inline;
}
</style>
<!-- jquery.js -->
<script type="text/javascript" src="js/jquery/jquery-1.3.2.js">
</script>
<script type="text/javascript">
$(function(){
// id
$("div[id]").css("color","red");
// title normal div
$("div[title=normal]").css("color","blue");
// title normal2 span
$("span[title!=normal2]").css("color","red");
// test
$("span[title^=test]").css("font-size","20");
// 3
$("span[title$=3]").css("font-size","20");
// normal
$("span[title*=normal]").css("font-size","20");
// id, title test div
$("div[id][title$=test]").css("color","blue");
});
</script>
</head>
<body>
<span title="normal">
SPAN2
</span>
<div id="div1">
<h1>div h1</h1>
</div>
<div title="normal">
<h2 >div h2</h2>
</div>
<div>
<span>div span</span>
</div>
<div>
<span title="test123">
<span id="sp1" title="normal2">div.div.span1</span>
<span>div.div.span2</span>
</span>
</div>
<span title="normal2">
SPAN1
</span>
</body>
</html>