<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="js/jquery.js"></script>
<script>
window.onload = function(){
document.getElementById('btnok').onclick = function(){
//1.匹配具有size属性的元素
//$('font[size]').html('test');
//2.匹配属性值等于7的size的font元素
//$('font[size=7]').html('test');
//3.匹配属性值不等于7的font元素
//$('font[size!=7]').html('test');
//4.匹配属性值以re开头的font元素
//$('font[color^=re]').html('test');
//5.匹配属性值以ue结尾的font元素
//$('font[color$=ue]').html('test');
//6.匹配color属性包含bl的font元素
//$('font[color*=bl]').html('test');
//7.匹配同时具有color与size属性的font元素
$('font[size][color]').html('test');
}
}
</script>
</head>
<body>
<input type="button" id="btnok" value="匹配" />
<hr>
<font>第一个 font属性</font>
<hr>
<font size="7">第二个font元素,具有size属性</font>
<hr>
<font color="red">第三个font元素,具有color属性</font>
<hr>
<font size="5" color="blue">第四个font元素,同时具有size和color属性</font>
<hr>
</body>
</html>