Sunday, 26 November 2017

Inventory System by using HTML, CSS and Javascript








Inventory system by using HTML, CSS and javascript

<html>
<head>
<title>Product Price</title>
<style type="text/css">
#p1
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#p2
{
    font-family:Times New Roman;
}
#price
{
    font-family:Times New Roman;
}
#table
{
    border:1;
}
#f
{
    background-color:Yellow;
}
#total
{
    background-color:White;
}
</style>
</head>
<body>
<center>
<form name="f"  id="f">
<select name="product">
<option value="-1" >Select Product</option>
<option  value="0" id="p1" onclick="rvalue('p1')">Bread 40</option>
<option  value="1" id="p2" onclick="rvalue('p2')">Egg 12</option>
<option  value="2" id="p3" onclick="rvalue('p3')">Milk Packet 50</option>
<option  value="3" id="p4" onclick="rvalue('p4')">Burgger 60</option>
<option  value="4" id="p5" onclick="rvalue('p5')">Shwarma 40</option>

</select>
<br />
<input type="text" placeholder="Quantity" id="price" />
<button type="button" onclick="sum()">Add</button><br />
</form>
<br />
<table  id="table" border="1">
<tr>
<th>Sr.</th>
<th>Name</th>
<th>unit Price</th>
<th>Quanity</th>
<th>Total Price</th>
</tr>
</table>
<input type="text" id="total" />
<button type="button" onclick= "totall()">Total</button>
</center>

<script type="text/javascript">
    pname = new Array(5);
    pprice = new Array(5);
    pname[0] = "Bread";
    pprice[0] = 40;
    pname[1] = "Eggs";
    pprice[1] = 12;
    pname[2] = "Milk packet";
    pprice[2] = 50;
    pname[3] = "Burgger";
    pprice[3] = 60;
    pname[4] = "Shawarma";
    pprice[4] = 70;
    var index;
    var p=0, total=0, price=0,count=0;
    function rvalue(Pid) {
        index = document.getElementById(Pid).value;
      

    }
    function sum() {
        p = Number(document.getElementById("price").value);
        price = p * pprice[index];
        total += price;
       
        count++;
        var table = document.getElementById("table");
        var row = table.insertRow(-1);
        var cell1 = row.insertCell(0);
        cell1.innerHTML = count;
        var cell2 = row.insertCell(1);
        cell2.innerHTML = pname[index];
        var cell3 = row.insertCell(2);
        cell3.innerHTML = pprice[index];
        var cell4 = row.insertCell(3);
        cell4.innerHTML = p;
        var cell5 = row.insertCell(4);
        cell5.innerHTML = price;
        document.getElementById("f").reset();
        index = 0;
    }
    function totall() {
        document.getElementById("total").value = total;
    }
     
  
</script>


</body>
</html>

Wednesday, 22 November 2017

Use of Colspan and Rownspan in HTML table







Colspan and Rowsapn in HTML Table

<!doctype html />
<html>
<head>


</head>
<body>
<center>
<table border="1">
<tr><td rowspan="3">Day</td>
<td colspan="3">Seminar</td>


</tr>
<tr><td colspan="2">Shedule</td>
<td rowspan="2">Topic</td>


</tr>

<tr><td>Being</td>
<td>End</td>


</tr>
<tr><td rowspan="2">Monday</td>
<td rowspan="2">8:00 am</td>
<td rowspan="2">5:00 am</td>
<td>Intorduction ot XML</td>
</tr>
<tr><td>Validity DDT and RElax</td>

</tr>
<tr><td rowspan="3">Tuesday</td>
<td>8 am</td>
<td>11 am</td>
<td rowspan="2">XP Path</td>
</tr>
<tr><td>11 am</td>
<td>2 pm</td>


</tr>
<tr><td>2 pm</td>

<td>5 pm</td>
<td>Xml Transformation</td>
</tr>
<tr><td>Wednesday</td>
<td>8 am</td>
<td>12 pm</td>
<td>Xml Formatting</td>
</tr>
</table>


</center>
</body>



</html>