JAVASCRIPT

 JAVASCRIPT:-

1. script is a part of program 

2. Js is a case sensitivity language

3. Js is written inside the head section<head>

4. structure of js 

  <html>

<head>

<script language="Javascript">

logic


</script>

</head>

</html> 


 JAVASCRIPT statement:-

1. OUTPUT STATEMENT - document.write(); semicolon called line termination opertore;

2. Alert statement -  display alert message 

3. confirm statement - display confirmation message 

4. prompt - input statement 


<html>

<head>

<script language="JavaScript">

document.write("welcome to my program");

alert("this is alert box");

confirm("this is confirm box");

prompt("enter your name");




</script>

</head>

</html>


NOTE:- js can not support any type of html tags directly


<html>

<head>

<script language="JavaScript">

document.write("welcome to my program");

document.write("<br>")

document.write("this is second mess")

document.write("<font color='red' >welcome</font>")

alert("this is alert box");

confirm("this is confirm box");

prompt("enter your name");




</script>

</head>

</html>



JAVASCRIPT VARIABLES:- 

 variable is the name of location were user can store all type of data


a= 10

a=10.5

a=z

a=Ramesh

2. types of varaibles:-  

  i. variant variables :-variables is used to datatypes is called variant(int a , float b, string c)



ii. non variant variables :- dynamic variable - in this type of variable depend on data value

ex. a=10 data value

     a=10.5 

     a= Ramesh



HOW TO CRETATE VARIBALES IN JAVASCRIPT  .


syntax:- var name;

ex var  raj  


variable separator:- (; is called variable seperator)


ex. var name,city contry


#variable terminology:-

var a=10; - initialization



variable cascading:- 


int a=10

printf("this is the value of a %d" ,a);


cascading = messages + variable values

 

in c programming (,) commaa is called cascading operator 


in c++ programming << is called put to operator 

 

in js - + is called cascading operator



<html>

<head>

<script language="javaScript" >

var a=10;

document.write(a);

document.write("<br>");

document.write("the value of a -"  + a);



</script>

</head>

</html>

 


# user input 


<html>

<head>

<script language="javaScript" >

var a=10,b;

document.write(a);

document.write("<br>");

document.write("the value of a -"  + a);

document.write("<br>");

b=prompt("enter any number");

document.write("the value of b-"+b);





</script>

</head>

</html>




day3task1:- input following information form the user 

name

city

state

college

email

branch

semester

address

total

percentage

grade


logic 1 input all data by the user

logic 2 print all the information on computer screen

email- blue color ,add- <add> , grade- red with bold letter, percentage- big heading with blue color, name - highlighter 



<html>

<head>

<script language="JavaScript">

var name;

name=prompt("enter your name");

document.write(name);

document.write("<br>");

document.write("<mark>"+ name + "</mark>")

document.write("<br>");


document.write("<font color = 'red'>" + name + "</font>")

document.write("<br>");


document.write("<b>" + "your name is " + name + "</b>");




</script>

</head>

</html>


Comments

Popular posts from this blog

ViewState for state management

Database joining

INTRODUCTION OF C#