Posts

Showing posts from June, 2022

FY B.sc IT Practical 4(C) : Design a web page demonstrating different Core JavaScript references (Array, Boolean, Date, Function, Math, Number, Object, String, regExp).

  Array object code: <!DOCTYPE html> <html> <head> <title>Array object Demo</title> <script language="javascript"> var cars=["Saab","Volvo","BMW"]; document.write("Array length is: "+cars.length+"<br>"); document.write(cars.join["*"]); cars.push("Opel"); document.write("After insert: "+cars.toString()); cars.pop(); document.write("After delete: "+cars.toString()); cars.sort(); document.write("After sort: "+cars.toString()); cars.reverse(); document.write("After reverse: "+cars.toString()); </script> </head> <body> </body> </html> Boolean object code: <!DOCTYPE html> <html> <head> <title>Boolean object demo</title> <script language="javascript"> function myFunction() {   document.getElementById(...

FY B.sc IT Practical 4(B) : Design a web page demonstrating different looping statements.

  Code: <!DOCTYPE html> <html> <head> <title>Looping Statements</title> <script language="javascript"> document.write("For Loop demo:<br>"); for (i = 0; i < 5; i++) {   text1 += "The number is " + i + "<br>"; document.write(text1+" "); } document.write("<br>While Loop demo:<br>"); while (i < 10) { text2 += "The number is " + i; document.write(text2+" "); i++; } document.write("<br>Do-While Loop demo:<br>"); do { text3 += "The number is " + i; document.write(text3+" ");   i++; }while (i < 10); </script> </head> <body> </body> </html>

FY B.sc IT Practical 4(A): Design a web page demonstrating different conditional statements.

  Code: <!DOCTYPE html> <html> <head> <title>Conditional Statements</title> <script language="javascript"> var age = 20;   if( age > 18 ) {   document.write("<b>Qualifies for driving</b>");   } </script> </head> <body> </body> </html>

FY B.sc IT Practical 3(F): Write a java script program to design simple calculator

Program: <!DOCTYPE html> <html> <head> <title>Calculator</title> <script language="javascript"> function calc() { var n1,n2,opr,x; n1=parseInt(f1.s1.value); n2=parseInt(f1.s3.value); opr=f1.s2.value; if(opr=="add") x=n1+n2; else if(opr=="sub") x=n1-n2; else if(opr=="multi") x=n1*n2; else if(opr=="div") x=n1/n2; else alert("please select operator"); document.getElementById("ans").innerHTML="answer is:"+x; } </script> </head> <body> <form name="f1"> <table width=50%> <tr> <td>Number1<br> <select name="s1" size=1> <option>Select</option> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> ...