Data Types in JavaScript
Script:
var myheading="Welcome to Data Types";
var item1="HP-5010";
var qty=10;
var discount=null;
var price=10000;
var total=qty*price;
var dis_amount=total*discount/100;
var net_amount=total-dis_amount;
var withvalue=true;
var withoutvalue=false;
var order_link="<a href='orderpage.html'>Order Now</a>";
var courses=["UI and UX Design","UI and UX Development","Client Side Script","Server Side Script"];
var courses={
"UI":"HTML5",
"UX":"Jquery",
"Serverside":"PHP"
};
var jit="Jeevan IT Computer Education";
document.getElementById("institute").innerHTML=courses.Serverside+courses.UX+courses.UI;
HTML :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>data types</title>
<script src="datatypes.js"></script>
</head>
<body>
<h1 id="institute"></h1>
<script>
document.write("<h1 align='center'>"+myheading+"</h1>");
</script>
<table width="500" align="center" border="1" cellpadding="10" cellspacing="10">
<tr>
<td>Item Name</td>
<td><script>document.write(item1);</script></td>
</tr>
<tr>
<td>Quanity</td>
<td><script>document.write(qty);</script></td>
</tr>
<tr>
<td>Price</td>
<td><script>document.write(price);</script></td>
</tr>
<tr>
<td>Sub Tatal</td>
<td><script>document.write(total);</script></td>
</tr>
<tr>
<td>Discount</td>
<td><script>document.write(discount);</script></td>
</tr>
<tr>
<td>Net Amount</td>
<td><script>document.write(net_amount);</script></td>
</tr>
<tr>
<td colspan="2" align="right"><script>document.write(order_link);</script></td>
</tr>
</table>
<script src="datatypes.js"></script>
</body>
</html>
Order page.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>order page</title>
<script src="datatypes.js"></script>
</head>
<body>
<table width="500" align="center" border="1" cellpadding="10" cellspacing="10">
<tr>
<th colspan="2">Order Details<script>document.write(withvalue);</script></th>
</tr>
<tr>
<td>Item Name</td>
<td><script>document.write(item1);</script></td>
</tr>
<tr>
<td>Amount</td>
<td><script>document.write(net_amount);</script></td>
</tr>
</table>
<script>
if(10<9){
alert(withvalue);
}
else {
alert(withoutvalue);
}
</script>
</body>
</html>
Script:
var myheading="Welcome to Data Types";
var item1="HP-5010";
var qty=10;
var discount=null;
var price=10000;
var total=qty*price;
var dis_amount=total*discount/100;
var net_amount=total-dis_amount;
var withvalue=true;
var withoutvalue=false;
var order_link="<a href='orderpage.html'>Order Now</a>";
var courses=["UI and UX Design","UI and UX Development","Client Side Script","Server Side Script"];
var courses={
"UI":"HTML5",
"UX":"Jquery",
"Serverside":"PHP"
};
var jit="Jeevan IT Computer Education";
document.getElementById("institute").innerHTML=courses.Serverside+courses.UX+courses.UI;
HTML :
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>data types</title>
<script src="datatypes.js"></script>
</head>
<body>
<h1 id="institute"></h1>
<script>
document.write("<h1 align='center'>"+myheading+"</h1>");
</script>
<table width="500" align="center" border="1" cellpadding="10" cellspacing="10">
<tr>
<td>Item Name</td>
<td><script>document.write(item1);</script></td>
</tr>
<tr>
<td>Quanity</td>
<td><script>document.write(qty);</script></td>
</tr>
<tr>
<td>Price</td>
<td><script>document.write(price);</script></td>
</tr>
<tr>
<td>Sub Tatal</td>
<td><script>document.write(total);</script></td>
</tr>
<tr>
<td>Discount</td>
<td><script>document.write(discount);</script></td>
</tr>
<tr>
<td>Net Amount</td>
<td><script>document.write(net_amount);</script></td>
</tr>
<tr>
<td colspan="2" align="right"><script>document.write(order_link);</script></td>
</tr>
</table>
<script src="datatypes.js"></script>
</body>
</html>
Order page.html
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>order page</title>
<script src="datatypes.js"></script>
</head>
<body>
<table width="500" align="center" border="1" cellpadding="10" cellspacing="10">
<tr>
<th colspan="2">Order Details<script>document.write(withvalue);</script></th>
</tr>
<tr>
<td>Item Name</td>
<td><script>document.write(item1);</script></td>
</tr>
<tr>
<td>Amount</td>
<td><script>document.write(net_amount);</script></td>
</tr>
</table>
<script>
if(10<9){
alert(withvalue);
}
else {
alert(withoutvalue);
}
</script>
</body>
</html>
Comments
Post a Comment