Session 9

 

Session 9: Design a web page that accepts a matrix as input and computes its transpose. The web page should have two text boxes and a submit button labelled as Input Elements. After entering the number of rows of the input matrix in the first text box and number of columns of the input matrix in the second text box of the web page, SUBMIT button should be clicked. Once clicked, a number of text boxes which are equivalent to the number of elements in the matrix will appear along with a submit button at the bottom labelled as Compute Transpose. When the Compute Transpose button is clicked, the transpose of the input matrix has to be displayed. 

This is web page, which accepts Matrix as input and generates the transpose of the given matrix. This web page consists of two text boxes and two buttons. In two text boxes we must enter the no of rows and no of columns and the web page generates the no of text boxes for entering the values of the matrix depends up on the number of rows and columns given. In that textboxes we must enter values and then the web page generates the transpose of the given matrix.

 

<html><head>

<title>Matrix</title>

<script language="javascript"> function enter()

{

var a=form1.text1.value; var b=form1.text2.value; if(a==0||b==0)

alert(" you must enter values in textbox"); else

{

document.writeln("<form name='form2'>"); for(i=0;i<a;i++)

for(j=0;j<b;j++)

document.writeln("<input    type=text

name='text[i][j]'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); document.writeln("<br><center><input      type=button    value=' Enter   ' onClick='transpose()'></center>");

document.writeln("</form>");

}

}

function transpose()

{

for(i=0;i<a;i++) for(j=0;j<b;j++) a[i][j]=form2.text[i][j];

document.writeln("Entered matrix is :"); for(i=0;i<a;i++)

{

for(j=0;j<b;j++) document.writeln(a[i][j]+"\t"); document.writeln("<br>");

}

document.writeln(<BR><BR><BR>"); document.writeln("Transpose of given matrix is :"); for(i=0;i<a;i++)

for(j=0;j<b;j++)

 

b[i][j]=a[j][i]; for(i=0;i<a;i++)

{

for(j=0;j<b;j++) document.writeln(b[i][j]+"\t"); document.writeln("<br>");

}

}

</script></head>

<body><center>

<form name="form1">

No.    of         rows    :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input   type=text name="text1"><br><br>

No.    of         columns           :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input   type=text name="text2"><br><br>

<input           type=button    value="            Enter   " onClick='enter()'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;

<input type=button value=" Cancel ">

</form></center></body></html>













Comments

Popular posts from this blog

Session 4: DFD, ERD, and Data Dictionary

Session 13

Session-1 Scope Statement for the Online Railway Reservation System