-
Notifications
You must be signed in to change notification settings - Fork 0
/
UCII.html
38 lines (38 loc) · 1.81 KB
/
UCII.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<head>
<meta charset="utf-8" />
<title>Test</title>
<style type="text/css">
*{margin:0;padding:0;}
form{margin:20px auto;width: 558px;overflow:hidden;}
form p {float: right;}
#keyword{margin: 2px 0px 0px 2px;padding: 5px;width:544px;height:74px;font-size: 14px;font-family: Tahoma, 宋体;word-wrap: break-word;line-height: 18px;overflow-y: auto;overflow-x: hidden;outline: none;resize:none;}
#submit{float:right;display:inline-block;width:78px;padding: 0;height: 26px;line-height: 26px;text-align: center;font-size: 16px;font-family: "Microsoft Yahei";text-decoration: none;white-space:nowrap;border:1px solid #F57373;border-radius: 2px;background-image: -webkit-linear-gradient(top, #F95959 0%,#E74343 100%);color: #FFF;}
</style>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<body dataType=2 >
<form name="form1" mothed="post">
<p>还可以输入<span id="counter">140</span>个字</p>
<textarea placeholder="请输入文字" id="keyword" onkeydown='countChar("keyword","counter");' onkeyup='countChar("keyword","counter");' oncontextmenu='countChar("keyword","counter");'></textarea>
<button id="submit" type="submit">发布</button>
</form>
</body>
<script type="text/javascript" >
function countChar(textareaName,spanName) {
document.getElementById(spanName).innerHTML = 140 - document.getElementById(textareaName).value.length;
}
window.onload = function() {
document.getElementById('submit').onclick = function() {
if (document.getElementById('keyword').value.length <= 140
&& document.getElementById('keyword').value.length > 0) {
alert('已经发布');
} else {
alert('输入不满足要求!');
}
return false;
};
}
</script>
<script type="text/javascript" src='jingyangfengxiang.js'></script>
</html>