JS-event details

Source: Internet
Author: User
Tags truncated
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.