Introduction: 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)

Step 1: 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.

Step 2: Material Required

  • Microsoft Visual Studio Community or Web Developer
  • A PC
  • A browser (for testing)

Step 3: 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.

Step 4: 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}:

  1. Open the new website tab. File>New>Website...
  2. The New Web Site tab opens.
  3. Click on the ASP.NET EMPTY WEB SITE option.(you will find this under C#)
  4. A blank page loads up.
  5. Click on the Website option in the menu bar.
  6. Click ADD A NEW ITEM tab and select HTML option.

Refer to the next step for coding:

Step 5: 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.

Step 6: 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