编程时间:15小时左右
代码行数:约1200行
博客园发表量:4篇
所学知识点:
1)
getElementsByName 该方法与 getElementById() 方法相似,但是它查询元素的 name 属性,而不是 id 属性。 另外,因为一个文档中的 name 属性可能不唯一(如 HTML 表单中的单选按钮通常具有相同的 name 属性),所有 getElementsByName() 方法返回的是元素的数组,而不是一个元素。 <!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=utf-8" /> <title>getElementByName演示文档</title> <script type="text/javascript"> function btn2(){ var inputs=document.getElementsByName("input1"); for(var i=0;i<inputs.length;i++){ var input=inputs[i]; alert(input.value); } } </script> </head> <body> <input type=button value="点击" οnclick="btn2()" /> <input type=text name="input1" value="原来的内容1"/> <input type=text name="input1" value="原来的内容2"/> </body> </html> 2) application的Attribute是服务端的参数,也就是服务器关闭前,所有请求保存的参数 String str = "3"; int i = Integer.parseInt(str); Integer.parseInt((String)application.getAttribute("number")); application.getAttribute返回object类型,不能直接用Integer.parseInt方法 String getAttribute(String name) 根据属性名称获取属性值。 <% request.setCharacterEncoding("UTF-8"); String nam=request.getParameter("name"); String pwd=request.getParameter("pwd"); %> 登录的用户名为:<%=nam%><br> <%int number =0; if(application.getAttribute("number")==null){ number=1; } else{ number=Integer.parseInt((String)application.getAttribute("number")); number=number+1; }%> <span style="color:green;font-size:35px;">欢迎访问本站。您是第<%=number %>个访问用户。</span> <%application.setAttribute("number", String.valueOf(number)); %>转载于:https://www.cnblogs.com/zzstdruan1707-4/p/10934513.html
相关资源:数据结构—成绩单生成器