Tweet

JavaScript 3*3 lük iki matris tersini alma

head bölgesine yapıştırılacak bölüm :
<script language="javascript">
function matristers()
{
//3x3 matrislerin olusturulmasi ve degerlerinin atanmasi
var m1= new Array();
var m2= new Array();
for( i=0; i<3; i++)
{
m1[i]= new Array();
m2[i]= new Array();
for( j=0;j<3;j++)
{
m1[i][j]=prompt("1. matrisin"+i+".satir"+j+".sutun elemeanini giriniz");
document.getElementById("m1"+i+j).innerHTML=m1[i][j];
m2[i][j]=prompt("2.matrisin"+i+".satir"+j+".sutun elemanini giriniz");
document.getElementById("m2"+i+j).innerHTML=m2[i][j];
}
}
//matrisler olusturuldu
var m3= new Array();
for( i=0;i<3;i++)
{
m3[i]=new Array();
for( j=0;j<3;j++)
{
m3[i][j]=m1[j][i];
}
}
//yazdirma
for( i=0;i<3;i++)
{
for( j=0;j<3;j++)
{
document.getElementById("m3"+i+j).innerHTML=m3[i][j];
}
}
var m4= new Array();
for( i=0;i<3;i++)
{
m4[i]=new Array();
for( j=0;j<3;j++)
{
m4[i][j]=m2[j][i];
}
}
//yazdirma
for( i=0;i<3;i++)
{
for( j=0;j<3;j++)
{
document.getElementById("m4"+i+j).innerHTML=m4[i][j];
}
}
}
</script>
body e yapıştırılacak kısım:
<table width="245" border="1" align="center">
<tr>
<td width="117">
Matris1: <br>
<table border="1" id="m1">
<tr>
<td width="34"><div id="m100">&nbsp;</div></td>
<td width="33" ><div id="m101">&nbsp;</div></td>
<td width="30" ><div id="m102">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m110">&nbsp;</div></td>
<td><div id="m111">&nbsp;</div></td>
<td ><div id="m112">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m120">&nbsp;</div></td>
<td ><div id="m121">&nbsp;</div></td>
<td><div id="m122">&nbsp;</div></td>
</tr>
</table> </td>
<td width="112">Matris1 Ters: <br>
<table border="1" id="m3">
<tr>
<td width="28"><div id="m300">&nbsp;</div></td>
<td width="28" ><div id="m301">&nbsp;</div></td>
<td width="38" ><div id="m302">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m310">&nbsp;</div></td>
<td><div id="m311">&nbsp;</div></td>
<td ><div id="m312">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m320">&nbsp;</div></td>
<td ><div id="m321">&nbsp;</div></td>
<td><div id="m322">&nbsp;</div></td>
</tr>
</table></td>
</tr>
<tr>
<td>Matris2: <br>
<table border="1" id="m2">
<tr>
<td width="33"><div id="m200">&nbsp;</div></td>
<td width="34" ><div id="m201">&nbsp;</div></td>
<td width="27" ><div id="m202">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m210">&nbsp;</div></td>
<td><div id="m211">&nbsp;</div></td>
<td ><div id="m212">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m220">&nbsp;</div></td>
<td ><div id="m221">&nbsp;</div></td>
<td><div id="m222">&nbsp;</div></td>
</tr>
</table></td>
<td>Matris2 Ters:
<table border="1" id="m3">
<tr>
<td width="28"><div id="m400">&nbsp;</div></td>
<td width="28" ><div id="m401">&nbsp;</div></td>
<td width="38" ><div id="m402">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m410">&nbsp;</div></td>
<td><div id="m411">&nbsp;</div></td>
<td ><div id="m412">&nbsp;</div></td>
</tr>
<tr>
<td><div id="m420">&nbsp;</div></td>
<td ><div id="m421">&nbsp;</div></td>
<td><div id="m422">&nbsp;</div></td>
</tr>
</table>
<div align="center"></div>
<div align="center"></div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="button" name="hesapbuton" value="Hesapla" onClick="matristers();">
</div></td>
</tr>
</table>


Alpi
mekan17vatan55@hotmail.com
29 Mayis 2006 15:26

İlgili Olabilecek Makaleler


Yorumlar (0)




Ziyaretçi olarak yorum yazamazsınız. Üye olmak için tıklayın Üye iseniz giriş yapın.



MENÜ » FORUM
Menü » Takip et
RSS Facebook Twitter Friendfeed
Sık Kullanılanlar Google Yahoo Live
Menü » Paylaş
E-Posta ile gönder Twitter Facebook Friendfeed
Buzz Stumbleupon Delicious Digg