+ 1

How can i include Java script in html?

2nd May 2017, 7:21 AM
Cesar Petrescu
Cesar Petrescu - avatar
5 Answers
+ 7
Uite aici cum se face.....ar trebui sa ĂŽncepi cursul de javascript acolo scrie negru pe alb. https://code.sololearn.com/Wiv9Z9z3L6Az/?ref=app https://code.sololearn.com/WJly9ZuywWBU/?ref=app
2nd May 2017, 8:51 AM
Didi Georgel Danaila
Didi Georgel Danaila - avatar
+ 5
Add <script src=app.js></script> right before closing </body> Create a app.js put your js code there and save.
2nd May 2017, 7:26 AM
CalviŐ˛
CalviŐ˛ - avatar
+ 5
There are generally two ways how to do this: (1) via external JS-file or (2) integrating JS code in your HTML file. Here it is how to be done: 1) via external file: Create your JS-file, e.g. yourJsFile.js in the same folder as your HTML-file. Then add the following tag right above the </body>-tag in your HTML file (don't forget the quotation marks around "yourJsFile.js"): <script src="yourJs.File.js"></script> 2) integrating JS code in your HTML file: Write the <script></script> tags just before the </body>-tag inside your HTML-file and write your code between the script tag. For example: <!doctype html> <html> <head> </head> <body> <script> // put your JS code here </script> </body> </html>
2nd May 2017, 8:38 AM
Thanh Le
Thanh Le - avatar
+ 2
if you think my answer helped, then please consider marking it as the best answer. thank you in advance.
6th May 2017, 2:56 PM
Thanh Le
Thanh Le - avatar
0
ty
6th May 2017, 2:16 PM
Cesar Petrescu
Cesar Petrescu - avatar