Monday, April 7, 2014

JAVASCRIPT : LOOPING TABLE


Ini dia scriptnya silahkan di copas!
http://cantuman-bebonk.hol.es/cantuman.html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Cantuman Bebonk</title>
<style type="text/css">
<!--
body { background-color:#ffbcff; }
td { width:40px; height:40px; }
-->
</style>
<script language="javascript" type="text/javascript">
    function tabel(row,column) {
        if ((row > 100 ) || (column > 100)){
        alert("Maaf!...Kolom ataupun baris tidak boleh melebihi batas 100.");
        document.write("Maaf!...Kolom ataupun baris tidak boleh melebihi batas 100.");
        }
        else {
        var k = 0;
        document.write("<table border='1' cellspacing='0' bordercolor='#000000' style='text-align:center;' align='center'>");
        for ( i = 1 ; i <= row ; i++ ) {
        document.write("<tr>");
         for ( j = 1 ; j <= column ; j++ ) {
             k = k + 1;
            if  ( k % 2    == 0 )    { c = "#ffb9e1";b="#000000"; } else { c = "#ff3498";b="#000000"; }
/*//satu
if(k==27){c="#ff0060";b="#ffffff";}if(k==28){c="#ff0060";b="#ffffff";}if(k==29){c="#ff0060";b="#ffffff";}if(k==52){c="#ff0060";b="#ffffff";}if(k==54){c="#ff0060";b="#ffffff";}if(k==77){c="#ff0060";b="#ffffff";}if(k==78){c="#ff0060";b="#ffffff";}if(k==102){c="#ff0060";b="#ffffff";}if(k==104){c="#ff0060";b="#ffffff";}if(k==127){c="#ff0060";b="#ffffff";}if(k==128){c="#ff0060";b="#ffffff";}if(k==129){c="#ff0060";b="#ffffff";}
//dua
if(k==31){c="#ff0060";b="#ffffff";}if(k==32){c="#ff0060";b="#ffffff";}if(k==33){c="#ff0060";b="#ffffff";}if(k==56){c="#ff0060";b="#ffffff";}if(k==58){c="#ff0060";b="#ffffff";}if(k==81){c="#ff0060";b="#ffffff";}if(k==82){c="#ff0060";b="#ffffff";}if(k==83){c="#ff0060";b="#ffffff";}if(k==106){c="#ff0060";b="#ffffff";}if(k==108){c="#ff0060";b="#ffffff";}if(k==131){c="#ff0060";b="#ffffff";}if(k==133){c="#ff0060";b="#ffffff";}
//tiga
if(k==35){c="#ff0060";b="#ffffff";}if(k==60){c="#ff0060";b="#ffffff";}if(k==85){c="#ff0060";b="#ffffff";}if(k==110){c="#ff0060";b="#ffffff";}if(k==135){c="#ff0060";b="#ffffff";}if(k==136){c="#ff0060";b="#ffffff";}if(k==137){c="#ff0060";b="#ffffff";}
//empat
if(k==39){c="#ff0060";b="#ffffff";}if(k==40){c="#ff0060";b="#ffffff";}if(k==41){c="#ff0060";b="#ffffff";}if(k==64){c="#ff0060";b="#ffffff";}if(k==66){c="#ff0060";b="#ffffff";}if(k==89){c="#ff0060";b="#ffffff";}if(k==90){c="#ff0060";b="#ffffff";}if(k==91){c="#ff0060";b="#ffffff";}if(k==116){c="#ff0060";b="#ffffff";}if(k==141){c="#ff0060";b="#ffffff";}
//lima
if(k==44){c="#ff0060";b="#ffffff";}if(k==69){c="#ff0060";b="#ffffff";}if(k==94){c="#ff0060";b="#ffffff";}if(k==119){c="#ff0060";b="#ffffff";}if(k==144){c="#ff0060";b="#ffffff";}
//enam
if(k==47){c="#ff0060";b="#ffffff";}if(k==48){c="#ff0060";b="#ffffff";}if(k==49){c="#ff0060";b="#ffffff";}if(k==72){c="#ff0060";b="#ffffff";}if(k==97){c="#ff0060";b="#ffffff";}if(k==98){c="#ff0060";b="#ffffff";}if(k==99){c="#ff0060";b="#ffffff";}if(k==124){c="#ff0060";b="#ffffff";}if(k==149){c="#ff0060";b="#ffffff";}if(k==148){c="#ff0060";b="#ffffff";}if(k==147){c="#ff0060";b="#ffffff";}*/
              document.write("<td bgcolor='"+c+"' style='color : "+b+";'>"+k+"</td>");
          }
          document.write("</tr>");
         }
         document.write("</table>");
         }
        if ((baris == 7) && (kolom == 25)) {alert("Selamat anda berhasil :p ");} else {alert("Gagal, Cobalagi! :D ");}}
</script>
</head>
<body bgcolor= bgcolor= bgcolor="#FF33FF">
<h1 align="center" style="color:#CC0099">CARILAH POSISI BARIS DAN KOLOM YANG TEPAT!</h1>
<script language="javascript" type="text/javascript">
var baris,kolom;
baris = prompt("Masukan jumlah baris");
kolom = prompt("Masukan jumlah kolom");
tabel(parseInt(baris),parseInt(kolom));
</script>
</body>
</html>

 

0 comments:

Post a Comment