现在介绍xpath里,一些常用的函数,叫方法也行,一个意思。前面的网页案例,再改下源码
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul style="list-style:none">
<li><span>用户名:</span><input placeholder="8-12位字母数字" /></li>
<li><span>密码:</span><input placeholder="6-16位字母数字" /></li>
<li><span>验证码:</span><input placeholder="4位数字" /></li>
<li><button>按钮</button></li>
</ul>
<script>
document.getElementsByTagName('button')[0].onclick = function(){
alert("haha");
}
</script>
</body>
</html>
<