js创建方法的两种方式
1 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" 2 pageEncoding="ISO-8859-1"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 7 <title>Insert title here</title> 8 </head> 9 <body> 10 11 </body> 12 <script type="text/javascript"> 13 function show(){ 14 alert("ok") 15 } 16 //show(); 17 18 var shows=new Function("name","age",'alert(name+age)'); 19 shows('tom',12); 20 </script> 21 </html>
函数的属性
alert(shows.length)
alert(shows.toString())