Home>Article>Web Front-end> How to implement button click to jump in javascript

How to implement button click to jump in javascript

青灯夜游
青灯夜游 Original
2021-04-20 15:13:03 6246browse

Method: 1. Add the "onclick="location.href='//m.sbmmt.com/m/faq/url'"" statement to the button element to jump. 2. First bind the click event to the button element; then specify the function that will be executed when the click event is triggered; finally, in the execution function, use the "location.href" statement to set the jump function.

How to implement button click to jump in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

Method 1: Uselocation.hrefdirectly on the button element to jump

Method 2: Give Bind the click event to the button element and jump

      Document 

[Recommended learning:javascript advanced tutorial]

The above is the detailed content of How to implement button click to jump in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn