<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>操作文本框</title>
<script language="JavaScript" src="js/jquery-1.11.1.min.js"></script>
</head>
<body>
用户名:<input type="text" name="textinput" id="textinput"/><br/><br/>
<input type="submit" name="vbtn" id="vbtn" value="提交"/>
<input type="button" name="dbtn" id="dbtn" value="修改"/>
<script>
$(document).ready(function(){
$("#vbtn").click(function(){
if($("#textinput").val()!=""){
alert($("#textinput").val());
$("#textinput").attr("disaled","disaled");
}else{
alert("请输入文本内容");
$("#textinput").focus();
return false;
}
});
$("#dbtn").click(function(){
if($("#textinput").attr("disaled")=="disaled"){
$("#textinput").removeAttr("disabled");
}
});
})
</script>
</body>
</html>
【第六章】操作文本框
最新推荐文章于 2021-07-19 15:36:25 发布