Java, .NET, PHP, PYTHON, ANGULAR, ML, Data Science, Testing, CI Tutorials in Easy Languages.

"Best Software Training, Internship, Project Development center of Indore India, Helpline 780506-3968"

What is Javascript?

                                            

Javascript:-  It is the client-side (browser side) script-based language that is used to implement business logic, validation, animation, and dynamic design view in web application.

Javascript has modified and implemented using a different library.

1 Jquery

2 Angular

3 Angular Js

4 Node JS

5 React

6 React native

7 Knockout

8 Particle

9 Express




Javascript Architecture:-

DOM (Document Object Model):-


Javascript provides a separate window with a document to contain and access all Html elements.
Javascript can provide accessibility to all HTML elements.





If we want to access an HTML element using javascript then we can use two different syntax


1) document.getElementById("idname").attribute


2) document.getElementByName("elementname").attribute


<input type="text" id="txt"  />


a=document.getElementById("txt").value;





We can write Javascript under HTML document because without HTML document JS has no role.

     <script>
     document.write("Welcome in JS");
     alert("welcom in JS");
    </script>

note:-  if we write JAVASCRIPT internally then we should define it under the <head> section.

Complete Code with HTML and JS?

<!DOCTYPE html>
<html>
<head>
<title></title>
    <script>
     document.write("Welcome in JS");
     alert("welcom in JS");
    </script>

</head>
<body>
<p>Welcome in HTML</p>
</body>
</html>



How we declare a variable in Javascript?

we can directly declare a variable in JS without using datatype because JS is a loosely coupled script.

Syntax:-

identifier=value


<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
a=100;
b=200;
c=a+b;
document.write("<h1>"+ c +"</h1>");

</script>
</head>
<body>


</body>
</html>




Example 3:-

Create a script to complete the addition of two numbers?


<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function fun()
{
num1 = document.getElementById("txt1").value;
num2 = document.getElementById("txt2").value;
num3 = parseInt(num1)+parseInt(num2);
alert(num3);
}
</script>
</head>
<body>

 <input type="text" id="txt1" placeholder="Enter first number" />
 <br>
 <br>
 <input type="text" id="txt2" placeholder="Enter second number" />
 <br>
 <br>
 <input type="button" id="btnclick" value="Click" onclick="fun()">
</body>

</html>




Assignment:-

1) Templrature convertor from celsius to faharenhite?


2)  Create a Salary Calculator where basic, ta, da, comm,pf, leave will be entered by the user?








2 Comments

POST Answer of Questions and ASK to Doubt

  1. Name:Nayansi purwar

    1) Temperature convertor from celsius to faharenhite?

    /*
    html
    head

    script type="text/javascript"
    celcius=40;
    var fahrenhit=(celcius*1.8)+32;
    document.write("celcius to fahrenhit:" +fahrenhit);

    script
    head



    */

    ReplyDelete

  2. /*html
    head
    script
    function Fahrenheit() {
    c=document.getElementById('Celsius').value;
    F=c*1.8000 +32.00;
    //document.write("h3" + F + "*F h3");
    //document.getElementById('show').innerHTML= F;
    // alert("" + F + "*F");
    //console.log(F);
    script
    head
    html*/

    ReplyDelete

Post a Comment

POST Answer of Questions and ASK to Doubt

Previous Post Next Post