php-----留言板练习
留言板练习:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>无标题文档</title> 6 <script src="../jquery-1.11.2.min.js"></script> 7 </head> 8 9 <body> 10 <div id="nr"> 11 </div> 12 <div> 13 内容:<textarea id="txt"></textarea> 14 <br /> 15 <input type="button" value="提交" id="btn" /> 16 </div> 17 </body> 18 <script type="text/javascript"> 19 $(document).ready(function(e) { 20 $("#btn").click(function(){ 21 22 var nr = $("#txt").val(); 23 24 var str = nr+"<br>"; 25 26 $("#nr").append(str); 27 28 }) 29 }); 30 </script> 31 </html>
显示结果: