SoFunction
Updated on 2025-04-06

Solution to the problem without jumping

Solution to the problem without jumping

Updated: April 17, 2014 15:51:21 Author:
Have you ever encountered the jump failure? This is mainly due to the influence of bubble transmission. There is a good solution below. You can refer to it.
I encountered a problem when writing code today: the onclick event is used in html to implement the jump of = url, and the attribute href="javascrit:;" is added to the embedded elements. At this time, the jump of this sentence failed. Later, I checked the Internet and remembered that the events in JavaScript were transmitted in a bubble, and it might be that the embedded href event was organized.

The solution is: add a return false statement to the onclick method, so that the program forces the program to not continue to execute the following statement.
  • location
  • Don't jump

Related Articles

  • Bootstrap works display site practical project 2

    This article mainly shares practical projects of Bootstrap works display site, which has certain reference value. Interested friends can refer to it.
    2016-10-10
  • Quick Start 【Recommended】

    This article mainly introduces the basic knowledge. It has certain reference value, let’s take a look with the editor below
    2017-01-01
  • js implements a drop-down box with search function

    This article mainly introduces the drop-down box from js implementation to search in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.
    2020-01-01
  • Example analysis of JS array methods push() and pop() usage examples

    This article mainly introduces the usage of JS array methods push() and pop(). It analyzes the basic functions, principles, usage methods and operation precautions of JavaScript array push() and pop() methods in combination with examples. Friends who need it can refer to it.
    2020-01-01
  • Javascript+css achieves progress bar effect

    This article mainly introduces the effect of JavaScript+css to implement progress bars in detail. The sample code in the article is introduced in detail and has certain reference value. Interested friends can refer to it.
    2020-03-03
  • Getting Started with TypeScript - Interface

    In TypeScript, the purpose of an interface is to name these types and define contracts for your code or third-party code. This article will introduce the relevant knowledge of the TypeScript interface in detail.
    2017-03-03
  • Example of switching variable usage in js

    This article mainly shares the code of the switch variable usage example in js, which has good reference value. Let’s take a look with the editor below.
    2017-02-02
  • Description of the method of triggering the onchange event by js

    How to trigger the textbox control's onchange event through code in js code mode? After checking the information, I found that js provides a method, and all events that can trigger the control should be
    2014-03-03
  • Deep understanding of JavaScript series (4) immediately called function expressions

    When you learn JavaScript, you often encounter code that executes anonymous functions. Today, let’s mainly think about self-executing.
    2012-01-01
  • JS+CSS implements random callout (instance code)

    This article realizes the random call-in effect through js html and cass code. The code is simple and easy to understand, very good, and has certain reference value. If you need it, please refer to it.
    2019-11-11

Latest Comments