.in") directly. That is, replace the $inBox on lines 20 and 31 with $(".out>.in"). The logic is correct. Update solution two: External"/> .in") directly. That is, replace the $inBox on lines 20 and 31 with $(".out>.in"). The logic is correct. Update solution two: External">

Home  >  Article  >  Web Front-end  >  Detailed introduction to inline and external calls of js

Detailed introduction to inline and external calls of js

零下一度
零下一度Original
2017-07-21 17:32:192161browse

The inline and external calls of js are introduced in detail. Let’s take a look at them below.


If the above code (part of the code that implements the carousel image) is written inline in HTML, it will not work. An exception will occur. But if it is placed in an external js file and called in the head of html, an exception will occur (no error will be reported, but the carousel logic will be abnormal).

Solution: Do not use the global variable $inBox, but use $(".out>.in") directly. That is, replace the $inBox on lines 20 and 31 with $(".out>.in"). The logic is correct.


##Update

Solution two: The external js remains unchanged. When quoting in html, add defer="defer" to delay execution.

You can read another essay for the specific principles.

Solution 3: The external js remains unchanged. In HTML, just quote it at the end of the body.

The above is the detailed content of Detailed introduction to inline and external calls of js. 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