how to save javascript file in notepad

Save javascript file in notepad:
Introduction: I am going to explain, "how to save javascript file in notepad" and what will be the extension of javascript file Extension. Here is the step by step process to save js file in notepad.

1.Open Notepad by pressing Window+R from your PC

how to save javascript file in notepad



2. Write a program of javaScript.

hellow world program in  javascript with notepad


3. Press ctrl+S to save the file in your system.
4. After pressing ctrl+S it will ask for the name of your file.
5. Give a name of the file with .JS extension i.e.  "hello.js".


how to use javascript file in notepad

FAQ

Q.1  What is an extension of the javascript file?
Ans  .js

Q2.  How to run the javascript file?
Ans: There is several methods to run javascript file

  •         By the command prompt.
  •         By linking in HTML file.

Run javascript by command prompt

Step 1: Open command prompt
Step 2: Find the path where the javascript file is saved
Step 3: To run javascript type node hello.js  in command prompt.

Run javascript by linking in HTML file

Step 1: Link javascript file in <head> tag of HTML File by the following script tag.
<script type="text/javascript" src="path-of-hello.js"></script>
Step 2: Save HTML file and view in browser


Thanks for reading the post, If you have any question feel free to comment below.  
Read More

What is HTML ? Advantages and disadvantages of HTML all about html attribute,element,tag

"Advantage and DisAdvantage of HTML" (Hyper Text Markup Language)

"What is HTML"


"HTML" stands for  HyperText Markup language. Basically, HTML is used to mark up a web page by using HTML attributes. Html was created by "Sir Berners-Lee" in 1991. Later on, in 1995 HTML 2.0 was published with some extra specification. After the success of  HTML 2.0 in 1999 HTML 4.0.1 was published. Though HTML 4.01 version is used currently we are having HTML-5 version which is an extension to HTML 4.01, and this version was published in 2012.  

Every language has it own block where we write our code similarly HTML have also it's own block which starts with <HTML> and ends with </HTML>.

Html code is written by the programmer and it is saved as .html or .htm extension and viewed by any respected browser (i.e. Google Chrome, FireFox etc). To learn HTML there is no need backup of any other language. You can easily learn HTML by knowing some tag of HTML and some other basic thing. 

HTML Advantages


As we know that HTML is a markup language which is used for formatting web pages of websites. Here are some advantages and disadvantages of HTML which is following as:

1.HTML can be integrated easily with Javascript, Jquery and CSS.
2.Easy to understand due to a relevant and memorable HTML tag.
3.HTML supported by all browsers (i.e. Google Chrome, Opera Mini, Mozilla Firefox and         many more browser)
4.HTML is light weighted and fast to load.
5.HTML is a free and open source markup language, you don't need to buy a single line of code to design your website.
6.HTML have many tag and attributes which will short your line of code. 

HTML Disadvantages

1. By Html, we can develop only static web pages if you want to develop Dynamic webpages you need the knowledge of some other programming languages like .Net ,Java and also have knowledge of some scripting language (JQuery, JavaScript).
2. Security Features is less in HTML. 

What is HTML Attributes,HTML Tags and HTML Elements

HTML Attributes

HTML attributes are a special type of words which is used to control the element's behavior inside the opening tag. The actual use of HTML attributes is to modify the default functionality of an HTML element.

Here are some different type of HTML attributes
1.Required attribute
2.Optional attribute
3.Standard attribute
4.Event attribute

Example of HTML attributes

<a href="www.example.com">Google</a>
<p align="right">This is Element in HTML</p>


HTML attributes contain Key-Value pair information. In the above example, 'href' is an attribute whereas <a> is an anchor tag, we can say that Tags can also have attributes. HTML attributes contain some extra information for the tag so that we can modify any tag at my end.HTML attributes is just a modifier of HTML element type.

HTM Tag

HTM Tag is a special type of words which contains opening and closing angle bracket(< >). HTML tag example.
Some HTML Tag which is used most during web page development

<p> 
<b> 
<ol>
<ul>
<tr>
<td>
<html>
<figure> 
<button> 
<head> 
<header>
<option>
<progress>
<script>
<table>

HTML Elements 

HTML Elements contains some kind of information which is available with in HTML tag. HTML Element example.

<h1>I am heading as well as HTML elements</h1> 



What is HTML ? Advantages and disadvantages of HTML all about html attribute,element,tag
Advantages and disadvantages of HTML





Read More

Javascript date difference in years with asp.net and Html Control

Introduction

In this tutorial, I am going to show you how you can calculate the "difference between two dates in  years" using javascript asp.net. 


Javascript date difference in years with asp.net and Html Control
Javascript date difference in years


Description
In this Example, I am taking asp.net textBox, if you have HTML textbox, the method of getting value from textbox will be different.


Find date difference using javascript with asp.net
    
    <script type="text/javascript">
        function daysdifference() {
            var dob = document.getElementById('<%=txtdob.ClientID%>').value;
            var doj = document.getElementById('<%=txtdoj.ClientID%>').value;
            var date1 = new Date(doj);
            var date2 = new Date(dob);
            var y1 = date1.getFullYear();
            var y2 = date2.getFullYear();

            var diff = y1 - y2
            if (diff > 18) {
            }
            else {
                alert('Date of joining will be 18 year greater than DOB');
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td>Date Of Birth</td>
                    <td>
                        <asp:TextBox ID="txtdob" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Date of Joining</td>
                    <td>
                        <asp:TextBox ID="txtdoj" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <asp:Button ID="btn" Text="check" runat="server" OnClientClick="daysdifference()" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>

 How to find date difference using javascript HTML


<head >
    <title></title>
    <script type="text/javascript">
        function daysdifference() {
            var dob = document.getElementById('txtdob').value;
            var doj = document.getElementById('txtdoj').value;
            var date1 = new Date(doj);
            var date2 = new Date(dob);
            var y1 = date1.getFullYear();
            var y2 = date2.getFullYear();

            var diff = y1 - y2
            if (diff > 18) {
            }
            else {
                alert('Date of joining will be 18 year greater than DOB');
            }
        }
    </script>
</head>
<body>
    <form >
        <div>
            <table>
                <tr>
                    <td>Date Of Birth</td>
                    <td>
                        <input type="text" id="txtdob"  />
                    </td>
                </tr>
                <tr>
                    <td>Date of Joining</td>
                    <td>
                        <input type="text" id="txtdoj" />
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <button onclick="daysdifference()">Click me</button>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>


Read More