How to write, run and save code
- then simply load the HTML file in the browser
- Now link this js file with the HTML document using script tage like:
either in the body or in the head.
index.html styles.css script.js
The above CSS code only targets two element ‘a’ and ‘div’ element whose ID is ‘plain’.
Output: (Before Clicking anywhere on div)
Output: (After Clicking anywhere on div)
Learning from the Code
- Page is known as document for the purpose of scripting in a web page.
- Properties of the document can be referenced by writing document followed by a dot, followed by the property name. The document has lots of properties.
The above code is a decent example of how we should make a directory, how to link different types of code files with each other and how to write simple yet effective code.
- HTML Course | Understanding and Building Project Structure
- HTML Course | Structure of an HTML Document
- Understanding Rainbow Table Attack
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.