Home > Article > Web Front-end > How to solve the problem of sequential calling of js methods with duplicate names
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!