A button is a control-level object that has a higher precedence, so it cannot be directly linked like a picture or text, and can only be achieved by invoking the script in the Click event of a button.
Note: The quotation marks in the code of the onclick call can be nested only once in a single weight, and the quotes must be escaped with the "\" and the escaped quotation marks must conform to the inner quotation marks, such as:
Tip: Most methods and properties that belong to the window or Document object can omit the prefix window or document, such as the location.href in this example ( Location.href can also be abbreviated as location, because location's default object is href) is the window.location.href or document.location.href ellipsis.
Tip: In this case, you can also use the following method instead of Location.href
Location.replace (URL)
Location.assign (URL)
Navigate (URL)
Special Tips
After the code in the first step runs, the click button jumps to the link target. The second step opens the link in a new window after the button is clicked.
Special Notes
The main example is to open the link by capturing the user's Click event on the button with onclick, and then calling the Location object's Href method or the Window object's Open method. Another trick is to implement the link function by submitting the form, the button must be a type=submit type of button, the action value of the form is the link target, and the target is the way the link is opened.
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.