Php writes a web project to write a web project. Is it better to put JavaScript in a single js file, or to directly write it in an html page? What are the advantages and disadvantages? Php? Js? Web php write web Project
When writing a web project, is it better to put JavaScript in a single js file on the page, or to directly write it in an html page? What are the advantages and disadvantages? Php? Js? Web html php js
------ Solution --------------------
In any case, requirements always come first!
Now that you have used the path in js, you do not want to change it to a relative path.
So is it unnecessary to discuss built-in or external connection?
Of course, you can also embed an independent js file into the main template as a sub-template.
------ Solution --------------------
You can create a js file that stores specific paths. This File defines all path variables. Other js files use the path variables defined in this file. Then the js file that stores the path can be introduced before other js files.
For example, define path. js
It defines var filePath = "****";
The filePath is used as the path in other files.
When used, define in the page:
Script
Script
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.