1. js exits the current page, which is generally used for system logon exit: confirm (& quot ;..... & quot;). The "OK" dialog box is displayed. If you click "OK", "true" is returned automatically. Otherwise, "false" is returned. The event is canceled by default ), the parameter is a user-defined prompt in the pop-up box: functio... syntaxHighl
1. js exits the current page, which is generally used for system logon Exit:
Confirm ("..... "). OK is displayed. The" OK "dialog box is canceled. Click" OK "to return true automatically. Otherwise, false is returned. (This event is returned to the current page by default ), the parameter is the custom prompt information in the pop-up box.
Example:
Function logout (){
If (confirm ("log out? ")){
Window. location = "<% = path %>/logout. action? AccountType = Touch "; // Click OK to perform the operation
}
}
2. js adds a carriage return event to the button, and click the carriage return trigger button to execute the action: F13
For example, add a carriage return event to the BUTTON and perform the search operation.
Document. onkeydown = function (e ){
If (! E) e = window. event;
If (e. keyCode | e. which) = 13 ){
Document. getElementById ("sButton "). click (); // Add the carriage return event to the specified button according to the attribute id. The click events that trigger this button perform the following operations in sequence and call the searchAdmin () method.
}
}
Function searchAdmin (){
Var str = document. getElementById ("key"). value;
Window. location = "$ {path} search. action? Type = admin & key = "+ encodeURI (str ));
}
3. The JS page intercepts characters and limits the display length of characters. If the display length exceeds the length range, use "...".
First, introduce the tag library on the page:
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
Then, use the c tag to determine where the fn tag is to be displayed. The substring (...) of the fn tag (..,..) truncation. The first parameter is the subscript at the beginning of the character to be truncated, and the second parameter is the length to be truncated.
/Scenic/addOrUpdateAdmin. jsp? Type = show & id =$ {str. id} ">
From the column ABCJIECBA