Home  >  Article  >  Web Front-end  >  How to solve the problem of sequential calling of js methods with duplicate names

How to solve the problem of sequential calling of js methods with duplicate names

巴扎黑
巴扎黑Original
2017-07-22 15:34:451825browse

When the methods in js have the same name, The last introduced js will overwrite the previously introduced js ( means that the method in the last imported js will be called ) For details, please refer to ( a() of main.js and white.js)
However, when there is a grammatical error in the last js (it can also be a format error in other methods in this js file), the previous js will be called Chinese method. For details, please refer to (b() of main1.js and white1.js)

<!DOCTYPE html><html lang="en">

  <script src="js/main.js?1.1.11"></script>
  <script src="js/white.js?1.1.11"></script> <script src="js/main1.js?1.1.11"></script>
  <script src="js/white1.js?1.1.11"></script>   <head></head><Button value="ceshi" onclick="a()">main  white</Button><Button value="ceshi" onclick="b()">main1  white1</Button><body></body></html>

Several small cases of js files

"main---->a()""white---->a()""main1---->b()""white1---->b()"

The above is the detailed content of How to solve the problem of sequential calling of js methods with duplicate names. 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