Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Saturday 28 January 2012

Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators.


<html>
<head>
<title>GTU SECOND PROGRAM </title>
<head>
<script language="javascript">
document.write("Use of ShortHand Operator");
document.write("<br><br>=================================<br>");
var A=100,B=50;
document.write("A = "+A + ",  B = "+B+"<br><br>");
document.write("1. A+=B : "+(A+=B)+"<br\>");
var A=100,B=50;
document.write("2. A-=B : "+(A-=B)+"<br\>");
var A=100,B=50;
document.write("3. A*=B : "+(A*=B)+"<br\>");
var A=100,B=50;
document.write("4. A/=B : "+(A/=B)+"<br\>");
document.write("=================================<br>");
</script>
</head>
<body>
</body>
</html>

Write a JavaScript that shows how a variable’s type can be changed on-the-fly.


<html>
<head>
<title>GTU FIRST PROGRAM</title>
<script language="javascript">
var a;
document.write("<table border=6  align=center>");
document.write("<caption>VALUE CHANGE ONLY ONE VARUABLE</caption>");
document.write("<tr><td><table border=0 cellspacing=10 cellpadding=5><tr><th>S.No.<th>VARIABLE<th>DATA TYPE<th>VALUE");
a=10;
document.write("<tr><td>1<td>a<td>"+typeof(a)+"<td>"+a);
a='V'
document.write("<tr><td>2<td>a<td>"+typeof(a)+"<td>"+a);
a=10.50;
document.write("<tr><td>3<td>a<td>"+typeof(a)+"<td>"+a);
a="VIJAY-PANKAJ";
document.write("<tr><td>4<td>a<td>"+typeof(a)+"<td>"+a);
a=false;
document.write("<tr><td>5<td>a<td>"+typeof(a)+"<td>"+a);
document.write("</table></table>");
</script>
</head>
<body>
</body>
</html>

OUTPUT