WEEK-07: AIM: Program Code To Develop A Multiplication Matrix Table. Code

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Name:Dharmateja Section: CSE-02 Roll No.

: 160119733088

WEEK-07

AIM: Program code to develop a multiplication matrix table.

CODE:

<html>
<head>
<script>
function myFunction(){
var a=document.getElementById("start").value;

document.write("<h2>Multiplcation table</h2>")
document.write("<table border=1>")

for(var i=1;i<=a;i++){
document.write("<tr>")
for(var j=1;j<11;j++){
document.write("<td>"+ i*j +"</td>")
}
document.write("</tr>")
}
document.write("</table>")
}

</script>
</head>

<body>
<h2>MultiplicationTable</h2>
<label>
NO.of tables to be displayed:
<input type="text" id="start">
</label><br>

<button onclick="myFunction()">Print Table</button>


<p id="table"></p>
</body>
</html>

1|Page
OUTPUT:
AIM: Code to take few pizza orders or cancel orders.

CODE:

<!doctype html>
<html lang="en">
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU"
crossorigin="anonymous">

<script>
function bill(){
var a=document.getElementById("pizza1");
var a_val=a.options[a.selectedIndex].value;
var b=document.getElementById("pizza2");
var b_val=b.options[b.selectedIndex].value;
var c=document.getElementById("pizza3");
var c_val=c.options[c.selectedIndex].value;
var d=document.getElementById("pizza4");
var d_val=d.options[d.selectedIndex].value;
var e=document.getElementById("pizza5");
var e_val=e.options[e.selectedIndex].value;
var total=(450*a_val)+(199*b_val)+(450*c_val)+(399*d_val)+(459*e_val);
document.getElementById("456").value=total;
document.getElementById("123").value=total+((5*total)/100);

}
function book(){
document.getElementById("pizza1").value=0;
document.getElementById("pizza2").value=0;
document.getElementById("pizza3").value=0;
document.getElementById("pizza4").value=0;
document.getElementById("pizza5").value=0;
document.getElementById("123").value=0;
document.getElementById("456").value=0;
alert("THANK YOU FOR CONFORMING YOUR ORDER!!!");
}
function cancel(){

document.getElementById("pizza1").value=0;
document.getElementById("pizza2").value=0;
document.getElementById("pizza3").value=0;
document.getElementById("pizza4").value=0;
document.getElementById("pizza5").value=0;
document.getElementById("123").value=0;
document.getElementById("456").value=0;
alert("CANCELLED! Please visit again. . .");
}
</script>

<title>Do you want Pizza!</title>


</head>
<body>
<h1>Pizza Order</h1>
<div class="table">
<table border="1" class="table table-bordered">
<tr>
<th>Items</th>
<th>Price(per item)</th>
<th>Quantity</th>
</tr>
<tr>
<td>Paneer spicy pizza</td>
<td>Rs 450</td>
<td><select id="pizza1">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr>

<tr>
<td>Margherita</td>
<td>Rs 199</td>
<td><select id="pizza2">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr>

<tr>
<td>Chicken tikka pizza</td>
<td>Rs 450</td>
<td><select id="pizza3">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr>

<tr>
<td>Indi Tandoori Paneer Pizza</td>
<td>Rs 399</td>
<td><select id="pizza4">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr>

<tr>
<td>Deluxe Veggie pizza</td>
<td>Rs 459</td>
<td><select id="pizza5">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</td>
</tr>
</table>
<br/><br/>
<div class="container">
<button type="button" class="btn btn-primary" onclick="bill()">VIEW
AMOUNT</button><br/><br/>

Total amount:<input type="text" id="456"/><br/><br/>


GRAND TOTAL (including taxes):
<input type="text" id="123"/>
<br/><br/>
<button type="button" class="btn btn-primary" onclick="book()">BOOK
ORDER</button><br/><br/>
<button type="button" class="btn btn-primary" onclick="cancel()"> CANCEL</button>
<br/>
</div>
</div>
</body>
</html>

OUTPUT:
AIM: Javascript code to move image to a specified location.

CODE:

<html>
<head><title> Move Image </title>

<style type="text/css">
#kids { position: relative;
}
</style>

<script type="text/javascript">

function moveIt()
{
var x = document.getElementById("x").value;
var y = document.getElementById("y").value;

var kids = document.getElementById("kids").style;

kids.top = x + "px";
kids.left = y + "px";

</script>
</head>
<body>

<form>
X axis: <input type="text" id="x"><br />
Y axis: <input type="text" id="y"><br />
<input type="button" value=" Move " onclick="moveIt()" >
</form>

<div id="kids">
<img
src="ngc604.jpg"
width="400" height="200">
</div>
</body>
</html>

OUTPUT:

You might also like