Download presentation
Presentation is loading. Please wait.
Published byOlivia Golden Modified over 9 years ago
1
Lesson 14
2
<!-- function Addit() { var num1=document.Calform.One.value; var num2=document.Calform.Two.value; document.write("The result of this addition is " + (parseFloat(num1)+parseFloat(num2))); } function minus() { var num1=document.Calform.One.value; var num2=document.Calform.Two.value; document.write("The result of this subtraction is " + (parseFloat(num1)-parseFloat(num2))); } //--> First Number: Second Number:
7
<!-- function Multiplyit() { var num1=document.Calform.One.value; var num2=document.Calform.Two.value; alert(parseFloat(num1)*parseFloat(num2)); } function Divideit() { var num1=document.Calform.One.value; var num2=document.Calform.Two.value; alert(parseFloat(num1)/parseFloat(num2)); } //--> Multiply and Divide Calculator First Number: Second Number:
11
A Drop-Down List of Links <!-- function GoToIt(list) { var selection = list.options[list.selectedIndex].value if (selection != "None") location.href = selection } //--> Select a page previously done ---> Calculator Style Sheet Web Forms Table Margins Frames
12
<!-- function minus() { var num1=document.Calform.One.value; var num2=document.Calform.Two.value; if(parseFloat(num1)<parseFloat(num2)) {alert("negative"); } else { alert(parseFloat(num1)-parseFloat(num2)); } //--> First Number: Second Number:
15
Loops For loop for(intialization;condition;increment) {statements} While loop while(codition){statements} Do while loop do{statements}while(condition) Keep on executing a code till a certain condition is met.
16
For Loop Using the For Statement <!-- for(i=1;i<7;i++) document.write(" Hello "+i+"!! "); //->
18
Some Predefined Objects Global Array String Math Date … etc.
19
Example of Math object Using the Math object Using the Math object <!-- document.write("Math.PI :" +Math.PI +" "); document.write("Math.LN2 :"+Math.LN2+" "); document.write("Math.sin(90) :"+Math.sin(90)+" "); document.write("Math.random() :"+Math.random()+" "); document.write("Math.pow(2,3) :"+Math.pow(2,3)+" "); document.write("Math.min(123,133): "+Math.min(123,133)+" "); //-->
21
Array Object Using Arrays Using Arrays <!-- myArray=[0,1,2,3,4,5,6,7,8,9,10]; document.write("myArray: first element " +myArray[0]+" "); document.write("myArray.toString(): "+myArray.toString()+" "); document.write("myArray.join(':'): "+myArray.join(':')+" "); document.write("myArray.reverse(): "+myArray.reverse()+" "); document.write("myArray.sort(): "+myArray.sort()+" "); //-->
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.