Simple Javascript Coding in HTML
by Harshvardhan Singh in Circuits > Websites
1590 Views, 3 Favorites, 0 Comments
Simple Javascript Coding in HTML
Hello guys it's Harsh and today I am going to show you some simple and easy bit of JavaScript coding.(not Java)
Getting to Know JavaScript
JavaScript is a high-level, dynamic, untyped, and interpreted programming language. It has been standardized in the ECMAScript language specification. Alongside HTML and CSS, it is one of the three essential technologies of World Wide Web content production; the majority of websites employ it and it is supported by all modern web browsers without plug-ins. JavaScript is prototype-based with first-class functions, making it a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles. It has an API for working with text, arrays, dates and regular expressions, but does not include any I/O, such as networking, storage or graphics facilities, relying for these upon the host environment in which it is embedded.
Material Required
- Microsoft Visual Studio Community or Web Developer
- A PC
- A browser (for testing)
Pre-note
JavaScript is a web coding language and is not similar to Java. JavaScript cannot work independently
and requires HTML to support its functions. Unlike HTML, JavaScript is case-sensitive language and a single cannot be written on two different lines. I uses strict parameters of coding and developing.
Getting Started
In this INSTRUCTABLE, I am just going to start with very basic and easy bit of coding as this is the first Instructable in this series.(Believe me JavaScript can get very nasty if I start off with complicated stuff)
To begin coding open Visual Studio and follow the given steps {You can refer to the images as well}:
- Open the new website tab. File>New>Website...
- The New Web Site tab opens.
- Click on the ASP.NET EMPTY WEB SITE option.(you will find this under C#)
- A blank page loads up.
- Click on the Website option in the menu bar.
- Click ADD A NEW ITEM tab and select HTML option.
Refer to the next step for coding:
Coding
Some pre written codes appear when a HTML page is loaded. Just leave that code untouched. Head off to the <body> tag and write the following:
<body>
<script type="text/javascript">
document.write("Hello Instructables!");
document.write("I can write Javascript!");
</script>
</body>
* this bit of code displays a simple message.
the document.write initiates the notepad in the script which allows you to display messages.
remember to put the ";" after every line of code and also the write a single code on a single line.
after you are done Test the site by clicking the Debug option in the menu bar and start the debug. if everything is right it would show up the message.
Now You Can Write JavaScript
Now after this Instructable you can at-least display up a message in JavaScript. Keep an eye on the other tutorials of this JavaScript series to code more of it. Reminding you again, this script requires strict parameters of coding and casing so be careful while coding it. Thanks and meet you in next INSTRUCTABLE.
Thanking You
Harsh