HTML(Structural)
CSS (Presentational)
JAVASCRIPT (Behavioral)
What is Script?
It describes executable files which will be used in a web page. Using JavaScript, you can make the web page more interactive.
In HTML, JavaScript is used in Form validation, image manipulation, etc.
A <script> Tag
The <script> tag describes client- side script that is JavaScript. It is easier to place your script tag within the HTML document.
Method used in JavaScript to get element is document.getElementById()
Click on a circle to fill the color
Example
<script> function mouseDown() { document.getElementById("circle").style.background= "orange"; } </script>
<noscript> Tag
When browsers do not support JavaScript or when scripts or disabled, you can use <noscript> tag.
The <noscript> tag provides alternative details to the users.
Example
<script> function mouseDown() { document.getElementById("test").innerHTML = "This is JavaScript"; } </script> <noscript> The sentence or code given inside noscript tag will appear when browser does not support JavaScript! </noscript>
Event Handlers in HTML JavaScript
You will receive a notification when you mouse over here
Example
<p onmouseover="EventHandler();"> You will receive a notification when you mouse over here </p> <script type="text/JavaScript"> function EventHandler() { alert("Welcome to TutorialBrain!!"); } </script>
Interview Questions & Answer
HTML is a base to create a webpage. Tags are used to build a webpage in HTML.
CSS is used to design a webpage. Like adding a background, changing color, styling a webpage is known as CSS.
JavaScript describes executable files which will be used in a web page. Using JavaScript makes the web page more interactive.
The <script> tag describes client-side script that is JavaScript. It is easier to place your script tag within the HTML document. It describes executable files which will be used in a web page. JavaScript makes the web page more interactive in HTML. It is used in Form validation, image manipulation.
When browsers do not support JavaScript or when scripts or disabled <noscript> tag provides alternative details to the users.
Yes, we can modify the attribute value in the HTML dynamically using JavaScript.
Method used in JavaScript to get element is
document.getElementById()
One example to modify text to password
<input type="text" id="inputField"> document.getElementById("inputField").attr("type", "password");