亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

輸入數(shù)據(jù)練習(xí)

原創(chuàng) 2019-02-27 12:07:18 257
摘要:<!DOCTYPE html><html><head><meta charset="utf-8"><title></title><style type="text/css">*{margin: 0;padding: 0px;}.box1{width: 500px;height

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

<style type="text/css">

*{margin: 0;padding: 0px;}

.box1{width: 500px;height: 400px;background: pink;margin: 0 auto;}

.box2{width: 200px;height: 30px;font-size: 20px;line-height: 30px;float:right;}

.box2 span{font-size: 25px;}

textarea{width: 498px;height: 200px;background: #ccc;font-size: 20px;}

button{float:right;width: 40px;height: 20px;margin-right: 20px;background: blue;}

</style>

<script type="text/javascript">

var num, txt, x

window.onload = function (){

num = document.getElementById('num')

txt = document.getElementById('txt')

bt = document.getElementById('bt')

txt.onkeyup = function my(){

x = 140-txt.value.length

num.innerHTML = x

if(x>=0){

num.style.color ='red'

} else{

num.style.color= 'blue'

}

}

bt.onclick = function (){

if(x==140){

alert('請(qǐng)輸入內(nèi)容')

txt.foucus()

}else if(x<0){

alert('超出字?jǐn)?shù)')

}else{alert('發(fā)布成功')

}

}

my()

}


</script>

</head>

<body>

<div class="box1">

<div class="box2">你還可以輸入<span id="num"></span>個(gè)數(shù)字</div>

<textarea id="txt"></textarea>

<input type="button" value="發(fā)布" id="bt">

</div>

</body>

</html>


發(fā)布手記

熱門詞條