简体   繁体   中英

How to put a .js file in html

The question seeems pretty simple.The usual method is simply using this code

<script src='https://code.angularjs.org/1.0.0rc9/angular-1.0.0rc9.js' type='text/javascript'/>

Alternatively, in Jsfiddle, we use the "External resources tab"


(source: ctrlv.in )

I have issues in implementing a particular code in my website. After much troubleshooting, I found out that, if I use this code to put a .js file:

 <script src='file link here' type='text/javascript'/>

the code doesn't work. If I use the external resources option in jsfiddle, it works. If I manually put it, it doesn't

Working fiddle: http://jsfiddle.net/U7Bz9/1972/ Unworking fiddle : http://jsfiddle.net/U7Bz9/1973/

I am shocked as to how this is possible.

The end tag for script elements is mandatory .

<script 
    src='https://code.angularjs.org/1.0.0rc9/angular-1.0.0rc9.js' 
    type='text/javascript'>
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM