简单的留言板jquery

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content" content="text/html" charset="utf-8"/>

<style type="text/css">
#kuang{
width: 400px;
height: 400px;
background-color: burlywood;
}
</style>
</head>

<body>
<div id="kuang"></div>
<input type="text" id="text"/>
<input type="button" value="提交" onclick="test()"/>
</div>
</body>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
function test(){
var myval=$("#text").val();//得到输入框中的内容
$("#kuang").html(myval+"<br/>"+ $("#kuang").html());//保存上次的记录并换行  添加新记录
$("#text").val("");//发送完毕清楚输入框中的内容
}

</script>
</html>

你可能感兴趣的:(jquery)