您的位置:首页 > Web前端

Ferris教程学习笔记:js示例3.3 累加按钮,自加1

2013-12-13 16:38 711 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>累加按钮,自加1</title>
<style type="text/css">
body{text-align:center;}
input{font:12px arial;cursor:pointer;padding:0 10px;}
</style>
</head>
<body>
<input value="2" type="button">
<script type="text/javascript">
window.onload = function(){
var input = document.getElementsByTagName("input")[0];
input.onclick = function(){
this.value = ++this.value;
};
};
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: