咱是只會改成get。。。但是取得網址後判斷parameters是什么意思?
順便在這里問多一些東西好了
- <html>
- <head>
- <title>Strings</title>
- <script>
- var str = new String("hippo");
- //the length method returns the number of characters in the string object
- var len = str.length;
- document.writeln("<BR>" + "There are " + len + " characters in " + str);
- //the charAt method returns the character at the index specified by its parameter.
- var ch = str.charAt(2);
- document.writeln("<BR>" + " The character at index 2(location 3) in " + str + " is " +ch);
- //to display the string in upper case(or lowercase) use the toUpperCase method (or toLowerCase)
- document.writeln("<BR>" + "The string in upper case is " + str.toUpperCase());
- //to get the index of the first occurence of the character in the String object use the IndexOf method
- var idx = str.indexOf('p');
- document.writeln("<BR>" + "The FIRST occurence of the character p is at index " + idx);
- //to get the index of the last occurence of the character in the String object use the IndexOf method
- var lastidx = str.lastIndexOf('p');
- document.writeln("<BR>" + "The LAST occurence of the character p is at index " + lastidx);
- </script>
- </head>
- <body>
- </body>
- </html>
- <html>
- <head>
- <title>Arrays</title>
- <script>
- var names = new Array(4); //declaring an array of 4 objects;
-
- //initializing the elements with 4 String objects
- names[0] = "Jack"; names[1] = "Alfred"; names[2] = "Steve"; names[3] = "Robert";
- var len = names.length; //the length property returns the number of items in the array object
- document.writeln("<BR>" + "There are " + len + " names in the array ");
- //to display a particular element in the array use the index value -this is how we access the first element -Index 0
- document.writeln("<BR>" + "The first name in the array is " + names[0]);
- document.writeln("<BR>" + "The list contains ");
- for (x in names) // to display all elements in the array sequentially you need to use a loop
- document.write(" " +names[x]);
-
- document.writeln("<BR>" + "The list is reverse order => " + names.reverse()); //to display the contents in reverse order
-
- document.writeln("<BR>" + "The list is sorted order +> " +names.sort()); //to display the contents in sorted order
- document.writeln("<BR>" + "Removing " + names.pop() + " from the array");
- document.writeln("<BR>" + "Now the array contains " + names.length + " elements"); //removing the last element of the array
- names.push("James"); //adding an item to the array
- document.writeln("<BR>" + "After adding James, the array now contains " + names.length + " elements");
- </script>
- </head>
- <body>
- </body>
- </html>
卻就出那幾行字而已。。。
有特別的用意在嗎?