Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Monday, October 20, 2014

Table design


One Two
Three

 
table.my {
/* basic */
 background-color: #fff;
 margin: 0 auto;
 width: 200px;
 padding: 100px;
 text-align: center;
/* border-radius */
 border-radius: 20px;
/* box-shadow */
 box-shadow: rgba(0,0,0,0.8) 0 0 10px;
 border-collapse: collapse;
}

table td{
  color: white;
}

td.one{
    border-radius: 20px 0 0 0;
    background-color: black;
}
td.two{
    border-radius: 0 20px 0 0;
    background-color: darkgreen;
}
td.three{
    border-radius: 0 0 20px 20px;
    background-color: darkred;
} 

Friday, October 17, 2014

Write A User Define Function that calling function as argument in javascript.

Write A User Define Function that calling function as argument in javascript.
Code : udfcl.html
<html>
<head>
<script type="text/javascript">
 function display(a,b)
{
 return ("Goodafter noon");
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(display());
</script>
</body>
</html>

Write A User Define Function with argument and with return value using javascript.


Write A User Define Function with argument and with return value using javascript.
Code : udfrv.html
<html>
<head>
<script type="text/javascript">
function sub(a,b)
{
return(a-b);
}
</script>
</head>
<body>
<script type="text/javascript">
var d=sub(50,30);
document.write(d);
</script>
</body>
</html>

Write A User Define Function with no argument and with return value using javascript


Write A User Define Function with no argument and with return value using javascript.
Code : udfpv.html
<html>
<head>
<script type="text/javascript">
function sub(a,b)
{
document.write(a-b);
}
sub(50,30);
</script>
</head>
<body>
</body>
</html>

Write A User Define Function with no argument and no return value using javascript.


Write A User Define Function with no argument and no return value using javascript.
Code : udf.html
<html>
<body>
<script type="text/javascript">
function print()
{
document.write("Hello");
}
print();
</script>
</body>
</html>

Write A program to use of Type Function in javascript.


Write A program to use of Type Function in javascript.
Code : typefun.html
<html>
<body>
<script type="text/javascript">
document.write(isNaN(235));
document.write("<br>");
document.write(isNaN("hello"));
document.write("<br>");
var a=eval("130/2");
document.write(a);
document.write("<br>");
document.write(parseInt(34.40));
document.write("<br>");
document.write(parseFloat("abcd"));
document.write(parseFloat(34.30));
</script>
</body>
</html>

Write A program to use of String Function in javascript.(using all string method)


Write A program to use of String Function in javascript.(using all string method)
Code : stringfun3.html

<html>
<head>
<title> string function </title>
<style type="text/css">
.body
{
background:green;
color:violet;
font-size:35px;
line-height:180%;
}
</style>
<script type="text/javascript">
varstr="Hello World";
</script>
</head>
<body class="body">
<script type="text/javascript">
document.write("<br>charAt() : ");
document.write(str.charAt(8));
document.write("<br>Search() : ");
document.write(str.search("or") + " and ");
document.write(str.search("L"));
document.write("<br> Replace() : ");
document.write(str.replace("World","Good Morning"));
document.write("<br> Slice() : ");
document.write(str.slice(4,9));
document.write("<br>Substr() : ");
document.write(str.substr(8));
document.write("<br>SubString () : ");
document.write(str.substring(3,7)+ " and ");
document.write(str.substring(10));
document.write("<br>indexOf () : ");
document.write(str.indexOf("o",5)+ " and ");
document.write(str.indexOf("rl")+ " and ");
document.write(str.indexOf("Rl"));
document.write("<br>lastIndexOf() : ");
document.write(str.lastIndexOf("o",5)+ " and ");
document.write(str.lastIndexOf("rl"));
document.write("<br>fontcolor() : ");
document.write(str.fontcolor("blue"));
document.write("<br>fontsize() : ");
document.write(str.fontsize(7));
</script>
</body>
</html>

Write A program to use of String Function in javascript.(using all formatting method)


Write A program to use of String Function in javascript.(using all formatting method)
Code : stringfun1.html

<html>
<head>
<title> Common string Functions </title>
<style type="text/css">
.body
{
background:black;
color:violet;
font-size:35px;
line-height:180%;
}
</style>
<script type="text/javascript">
varstr="Hello Good Afternoon";
var str1="H";
var str2="2";
</script>
</head>
<body class="body">
<script type="text/javascript">
document.write("<br>big() : Display string into bold face : ");
document.write(str.big());
document.write("<br>bold() : Display String into bold face : ");
document.write(str.bold());
document.write("<br>small() : Display string into small face : ");
document.write(str.small());
document.write("<br>italics() : Display string into italic face : ");
document.write(str.italics());
document.write("<br>strike() : Display string into strike-through face : ");
document.write(str.strike());
document.write("<br>sup() : Display string as superscript face: ");
document.write(str1+str2.sup());
document.write("<br>sub() : Display smaller font compared to normal font (subscript) : ");
document.write(str1+str2.sub()+"O");
document.write("<br>blink() : Displlay string into blinking effect : ");
document.write(str.blink());
</script>
</body>
</html>

Write A program to use of String Function in javascript.


Write A program to use of String Function in javascript.
Code : stringfun.html

<html>
<head>
<title> Common string Functions </title>
<script type="text/javascript">
varstr="GooDAfternooN";
var str1="Hello ";
</script>
</head>
<body>
<p align="Center">Common String Functions </p>
<script type="text/javascript">
document.write(str.length);
document.write(str.toLowerCase(str));
document.write(str.toUpperCase(str));
document.write(str1.concat(str));
</script>
</body>
</html>

Write A program to use of Math Function in javascript.


Write A program to use of Math Function in javascript.
Code : mathfun.html

<html>
<head>
<style type="text/css">
.body
{
color:blue;
font-size:30px;
}
</style>
<script type="text/javascript">
var num1=16.7;
var num2=3;
var num3=121;
</script>
</head>
<body class="body">
<script type="text/javascript">
document.write("ceil() : Returns rounded greater integer number : ");
document.write(Math.ceil(num1) + " and ");
document.write(Math.ceil(-5.12));
document.write("<br>floor() : Returns rounded lower integer number : ");
document.write(Math.floor(num1) + " and ");
document.write(Math.floor(-5.12));
document.write("<br>abs() : Returns an absolute value : ");
document.write(Math.abs(num1) + " and ");
document.write(Math.abs(-7));
document.write("<br>round() : Returns nearest integer number : ");
document.write(Math.round(num1) + " and ");
document.write(Math.round(-5.6));
document.write("<br>Max() : Returns the highest value from two values : ");
document.write(Math.max(num1,num2) + " and ");
document.write(Math.max(10,12));
document.write("<br>Min() : Returns the lowest value from two values : ");
document.write(Math.min(num1,num2) + " and ");
document.write(Math.min(10,12));
</script>
</body>
</html>

Write A program to use of Date Function in javascript.


Write A program to use of Date Function in javascript.
Code : datefun.html

<html>
<body>
<script type="text/javascript">
var d=new Date();
document.write(Date());
document.write("<br> Date is : ");
document.write(d.getDate());
document.write("<br>Miliseconds from 1/1/1970 is : ");
document.write(d.getTime());
document.write("<br>Year is : ");
document.write(d.getFullYear());
document.write("<br> Month is : ");
document.write(d.getMonth());
document.write("<br> Hour is : ");
document.write(d.getHours());
document.write("<br>Convaert date into string : ");
document.write(d.toString());
document.write("<br>Today is : ");
var a=d.getDay();
switch(a)
{
case 0:
document.write("sunday");
break;
case 1:
document.write("monday");
break;
case 2:
document.write("tuesday");
break;
case 3:
document.write("wednesday");
break;
case 4:
document.write("thursday");
break;
case 5:
document.write("friday");
break;
case 6:
document.write("saturday");
break;
}
</script>
</body>
</html>

Write A program to use of Associative Array in javascript.


Write A program to use of Associative Array in javascript.
Code : asso-array.html

<html>
<body>
<script type="text/javascript">
/* Associative Array */
var a={Name:"ABC" , Rollno:25 , Class:"B"};
document.write(a["Name"] + "<br>" + a["Rollno"] + "<br>" + a["Class"] +"<br>");
document.write("<br><br><br>");
/* Multidimentional Array */
var ma=new Array(["LAN","WAN","MAN"],["BUS","STAR","RIGN","TREE"],
["DATA","SIGNAL","SIGNALING","TRANSMISSION"]);
document.write(ma[0] + " <br>");
document.write(ma[1] + " <br>");
document.write(ma[2] + " <br>");
</script>
</body>
</html>

Write A program to use of Basic Array in javascript.


Write A program to use of Basic Array in javascript.
Code : basic-array.html

<html>
<body>
<script type="text/javascript">
var network=["LAN","WAN","MAN"];

document.write(network[0] +" Types of network. <br>");
document.write(network[1] +" Types of network. <br>");
document.write(network[2] +" Types of network. <br><br><br>");
varcs=[];
cs[0]="DATA";
cs[1]="SIGNAL";
cs[2]="SIGNALING";
cs[3]="TRANSMISSION";
document.write(cs);
document.write("<BR><BR><BR>");
var topology=["Bus","Ring","Star","Mash"];
for(var t in topology)
{
document.write(topology[t] + " is topology <br> ");
}
</script>
</body>
</html>

Write A program to use ofArray Function in javascript.


Write A program to use ofArray Function in javascript.
Code : arrayf.html

<!-- Array Functions -->
<html>
<head>

<style type="text/css">
.body
{
font-family:Maiandra GD;
color:blue;
font-size:30px;
}
</style>
</head>

<body class="body">

<script type="text/javascript">
var a=["BUS","STAR","TREE","MASH"];
var b=["RING","these are topologes"];
var c=a.concat(b);
document.write("<br>concat() : to mearge two or more array in to single array. :: "+c);
document.write("<br>join() : to join array element into string. Element will be separated by separator. :: ");
document.write(a.join("/"));
document.write("<br>pop() : takes last ele-ment of an array. :: ");
a.pop();
document.write(a);
document.write("<br>push() : Add one or more element onto the end of an array. :: ");
a.push("ABC","DEF");
document.write(a);
document.write("<br>shift() : takes the first element of an array. :: ");
a.shift();
document.write(a);
/*document.write("<br>unshift() : Add one or more element to the beginning of an array. :: ");
a.unshift("123","345");
document.write(a);
document.write("<br>reverse() : Print array element in reverse. :: ");
document.write(a.reverse());
document.write("<br>sort() : sort an array element alohabetically by default. :: ");
document.write(a.sort());

document.write("<br>lengh() : returns the lengh of an array. :: ");
document.write(a.length); */
</script>
</body>
</html>

Write A program to print 1 to 10 using while loop .


Write A program to print 1 to 10 using while loop .
Code : whileloop.html

<html>
<head>
<script type="text/javascript">
var i=1;
</script>
</head>
<body>
<script type="text/javascript">
while(i<10)
{
document.write(i);
document.write("<br>");
i+=2;
}
</script>
</body>
</html>

Write A program to check grade using switch case using Javascript .


Write A program to check grade using switch case using Javascript .
Code : switch.html

<html>
<head>
<script type="text/javascript">
var grade=prompt("Enter grade",0);
switch(grade)
{
case 'A':
document.write("Distriction");
break;
case 'B':
document.write("First Class");
break;
case 'C':
document.write("Passed");
break;
case 'D':
document.write("Failed");
break;
default:
document.write("Unknown grade");
}
</script>
</head>
</html>

Write A program to print 1 to 10 using for loop using Javascript .

Write A program to print 1 to 10 using for loop using Javascript . Code : forloop.html <html> <head> <script type="text/javascript"> var i; </script> </head> <body> <script type="text/javascript"> for(i=1;i<=10 ;i++) { document.write(i); document.write("<br>"); } </script> </body> </html>

Write A program to print 1 to 10 using do….while loop using Javascript .


Write A program to print 1 to 10 using do….while loop using Javascript .
Code : do-while.html

<html>
<head>
<script type="text/javascript">
var i=0;
</script>
</head>
<body>
<script type="text/javascript">
do
{
document.write(i);
document.write("<br>");
i+=1;
} while(i<10);
</script>
</body>
</html>

Write A program to use of Continue Statement using Javascript .


Write A program to use of Continue Statement using Javascript .
Code : continue.html

<html>
<body>
<script type="text/javascript">
var i=1;
for(i=1;i<=16;i++)
{
if(i>=5 && i<=8)
{
continue;
}
document.write(i);
document.write("<br>");
}
</script>
</body>
</html>

Write A program to use of Break Statement using Javascript .


Write A program to use of Break Statement using Javascript .
Code : break.html

<html>
<head>
<title> break statment</title>
<script type="text/javascript">
var i;
</script>
</head>
<body>
<script type="text/javascript">
for(i=4;i<9;i++)
{
if(i==7)
{
break;
}
document.write(i);
document.write("<br>");
}
</script>
</body></html>