1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| <html>
<head> <title> for test Array </title> <script language="javascript"> function write() { document.writeln("看看"); }
function add(a, b) { document.writeln(a + b); }
function returnValue(a) { return a * a; }
function hello() { window.alert("hello"); } </script>
<head>
<body> <pre> <a href = "#" onClick = "hello();">onClick</a>
<a href = "javascript:hello();">javascript</a> <script language = "javascript">
var arr = new Array(4); arr[0] = "c"; arr[1] = "h"; arr[2] = "a"; arr[3] = "d";
for(var i=0;i<4;i++) { document.writeln(arr[i]); } document.writeln(arr.sort());
var mystring = "a,x,d,e"; var arr1 = mystring.split(","); for(i=0;i<4;i++) { document.writeln(arr1[i]); } write(); add(4,6); document.writeln(returnValue(5));
</script> </pre> </body>
</html>
|