52. Show all links
Add the following code to the <body> area
<script language="JavaScript1.2"> <!-- function extractlinks(){ var links=document.all.tags("A") var total=links.length var win2=window.open("","","menubar,scrollbars,toolbar") win2.***(" <font size='2'>There are "+total+" connections in total</font> <br>") for (i=0;i <total;i++){ win2.***(" <font size='2'>"+links[i].outerHTML+" </font> <br>") } } //--> </script> <input type="button" onClick="extractlinks()" value="Show all links"> |
53. Enter key to change line
Add the following code to the <body> area
<script type="text/javascript"> function handleEnter (field, event) { var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if (keyCode == 13) { var i; for (i = 0; i < field.form.elements.length; i++) if (field == field.form.elements[i]) break; i = (i + 1) % field.form.elements.length; field.form.elements[i].focus(); return false; } else return true; } </script> <form> <input type="text" onkeypress="return handleEnter(this, event)"> <br> <input type="text" onkeypress="return handleEnter(this, event)"> <br> <textarea>Carriage return and line feed |
54. Submit after confirmation
Add the following code to the <body> area
<SCRIPT LANGUAGE="JavaScript"> <!-- function msg(){ if (confirm("Are you sure you want to submit!")) document.lnman.submit() } //--> </SCRIPT> <form name="lnman" method="post" action=""> <p> <input type="text" name="textfield" value="Submit after confirmation"> </p> <p> <input type="button" name="Submit" value="Submit" onclick="msg();"> </p> </form> |
55. Change the content of the table
Add the following code to the <body> area
<script ***script> var arr=new Array() arr[0]="一一一一一"; arr[1]="two two two two two"; arr[2]="three three three three three"; </script> <select onchange="zz.cells[this.selectedIndex].innerHTML=arr[this.selectedIndex]"> <option value=a>Change the first frame</option> <option value=a>Change the second frame</option> <option value=a>Change the third frame</option> </select> <table id=zz border=1> <tr height=20> <td width=150>First frame</td> <td width=150>Second frame</td> <td width=150>Third frame</td> </tr> </table> |