- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write the syntax of javascript with a code to demonstrate it?
JavaScript Tags
The html script tag wants the browser to get a script between them. We can expect the scripts to be in the following places.
1.The script can be placed in html's head tag
2.Within Html's body tag.
3.As an external file.
Most importantly client side scripts such as JavaScript are placed in script tags.
demonstration code
<html> <body> <p>This example writes "JavaScript is not java" into an HTML element with id="script"</p> <p id="imp"></p> <script> document.getElementById("imp").innerHTML = "JavaScript is not java"; </script> </body> </html>
Output
This example writes "JavaScript is not java" into an HTML element with id="script" JavaScript is not java
Explanation
Every JavaScript code should be in the script tag, if not the code wont execute.In the above example using attribute id the code has executed as "JavaScript is not java".
- Related Articles
- Create a syntax highlighting code with JavaScript.
- How to create and use a Syntax Highlighter with JavaScript?
- Demonstrate nested loops with return statements in JavaScript?
- How to write inline JavaScript code in HTML page?
- Write a Python code to combine two given series and convert it to a dataframe
- How to use Spread Syntax with arguments in JavaScript functions?
- Write the syntax to declare a scrollable cursor on the ORDERS DB2 table.
- How to check the syntax of a Bash script without running it in Linux?
- Write a C program to demonstrate post increment and pre increment operators
- How to represent the source code of an object with JavaScript Arrays?
- Write a Python code to read JSON data from a file and convert it to dataframe, CSV files
- What is the syntax to define enums in javascript?
- How to catch syntax errors in JavaScript?
- Write a Python code to find a cross tabulation of two dataframes
- Write a Python code to rename the given axis in a dataframe

Advertisements