Selasa, 08 Maret 2011

Modul6_Tugas Praktikum

 aku akan mencoba membuat program sederhana untuk men-generate sel tabel secara fleksibel.
Tekniknya, buat sebuah fungsi yang menerima argumen berupa jumlah sel

dan jumlah kolom. Jadi, pembentukan sel tabel didasarkan pada nilai jumlah
sel dan jumlah kolom yang diberikan. Sebagai contoh, hasil program dengan
argumen 12 (sel) dan 3 (kolom) diperlihatkan seperti Gambar 1pertama qta buat dlu file tugasprak.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Hasil Generate Tabel</title>
<body background="3.jpg">
</head>
<body>
<div align="center">
<?php
$rows = 1;
$columns = 1;
$cells = 1;
?>

<?php $rows = (int) $_POST["JumlahRow"]; ?>
<?php $columns = (int) $_POST["JumlahColum"]; ?>
<?php $cells = (int) $_POST["JumlahCell"]; ?>

<font face = "kristen itc" size = "4" color ="gold" left= 600px;>
<b>Banyaknya baris yang kamu pilih</b>  <?php echo $rows; ?> <em>rows,</em><br />
<b>Banyaknya kolom yang kamu pilih</b>  <?php echo $columns; ?> <em>columns,</em><br />
<b>So kamu membutuhkan</b>  <?php echo $cells; ?> <em>cells,</em><br />
<br />
<br />
<?php
$width = $columns * 75;
echo "<table width=".$width." border=1>";
$rw = 0;
$cel = 1;
while ($rw < $rows && $cel <= $cells)
{
echo "<tr>";
$cl = 0;
while ($cl < $columns)
{
if ($cel <= $cells)
{
echo "<td><div align=center>".$cel."</div></td>";
$cel++;
}
$cl++;
}
echo "</tr>";
$rw++;
}
echo "</table>";
?>
</div>
</body>
</html>


kedua kita buat dulu file tugasprak.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Generate Matriks Sel Pada Tabel</title>
<body background="3.jpg">

<style type="text/css">
<!--
#apDiv1 {
position:absolute;
width:178px;
height:24px;
z-index:1;
left: 284px;
top: 189px;
}
.style1 {
color: red;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form method="post" action="tugasprak.php">
<font face = "kristen itc" size = "4" color ="Pink" left= 600px;>
<h3 align="center" class="style1"><b>Generate Matriks Sel Pada Tabel</h3></b>
<div align="center">
<table width="327" border="0" bgcolor="pink">
<tr bgcolor="orange">
<td width="121" style="text-align:center">Baris</td>
<td width="196"><b>= </b>
<input name="JumlahRow" type="text" id="JumlahRow" onKeyUp="getmax();" onfocus="this.select();"></td>
</tr>
<tr bgcolor="yellow">
<td style="text-align:center"><label>Kolom</label></td>
<td><b>= </b>
<input name="JumlahColum" type="text" id="JumlahColum" onKeyUp="getmax();" onfocus="this.select();"></td>
</tr>
<tr bgcolor="yellow">
<td style="text-align:center">Jumlah sel</td>
<td><b>= </b>
<input name="JumlahCell" type="text" id="JumlahCell" onKeyUp="getmax();" onFocus="this.select();"></td>
</tr>
<tr bgcolor="orange">
<td style="text-align:center">Max jumlah sel</td>
<td><b>= </b>
<input name="maxcells" type="text" id="maxcells" disabled="disabled" style="text-align:center"></td>
</tr>
</table>
</div>
<div id="apDiv1">
<input type="submit" name="Generate" value="Generate" style="position:absolute; width:100px; height:30px; left: 325px; top: 30px; color : purple;" />
</div>
</form>
</body>


<script language="JavaScript" type="text/javascript">
<!--
function getmax() {
var R = parseInt(document.getElementById('JumlahRow').value);
var C = parseInt(document.getElementById('JumlahColum').value);
var X = parseInt(document.getElementById('JumlahCell').value);
var cellmax = document.getElementById('maxcells');
var total = 'N/A';
total = R * C;
cellmax.value = new String(total);
if (X > total)
{
alert('Cell Total Yang Anda Masukkan Terlalu Besar, Nilai Maksimum Cells = ' + total);
document.getElementById('CellsTotal').value = new String();
}
}
//-->

</script>
</html>

pengend tau gimana hasilnya ???






okeiii....gimana ???...moga-moga bisa bermanfaat ea sob...

Modul6_Studi Kasus

Sapaan menunjukkan keramahan seseorang....lha apakah dalam benak kalian prnah terfikirkan gimna sich caranya buat program greeting....yg biasany ada di tempat-tempat umum gtu....
hemmmm....ingin tau lbih jlasnya so plototin dueh...source codex n print screen....eits bis ntu dcoba lhow yaw
Awalnya yaw sob qta buat file cobastudikasus.php
<!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>

<title>Program Sapaan willys_poenya</title>
</head>
<body>

<center>

<h1>
<?php

function greeting()
{
$date = date ("G : i A");
if ($date>=0 and $date<10) {
echo "Good Morning";
} else if ($date>=10 and $date<15) {
echo "Good Afternoon";
} else if ($date>=15 and $date<19) {
echo "Good Evening ";
}else echo "Good Night ";
}
?>
<?php greeting(); ?><br>

</h1>
<font face = "kristen itc" size = "3" color ="purple" left= 600px;>
<h2 align="center" ><b> Welcome to Willys Poenya Area</b></h2></font>

<font face = "kristen itc" size = "3" color ="purple" left= 600px;>
<h3 > Now is


<?php

//Array Hari
$array_hari = array(1=>"Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday","Sunday");
$hari = $array_hari[date("N")];
//Format Tanggal
$tanggal = date ("j");
//Array Bulan
$array_bulan = array(1=>"January","February","March", "April", "May", "June","July","August","September","October", "November","December");
$bulan = $array_bulan[date("n")];
//Format Tahun
$tahun = date("Y");
//Digunakan untuk menampilkan hari,tanggal,bulan dan tahun
echo "$hari,$tanggal $bulan $tahun";
?>
<br>

Time shows at
<?php
// format penulisan waktu

$date = date ("G : i A");
echo "$date";
?>
<body background="2.jpg">

</h3>
<font face = "kristen itc" size = "3" color ="purple" left= 600px;>

<h4 align="center" >my.Greeting @2011 Wilis Dwi Probowati Poenya</h4></font>


<h5 align="center" > For next Info visit to :
<a href="cliq.willys282.blogspot.com" color ="purple" left= 600px; >
<br><b>cliq.willys282.blogspot.com<b></h5></font></br>

</body>

</html>

Lha nie print screenx sob....

Selasa, 01 Maret 2011

Modul5_Form pemesanan





lha ituw tampilan form pemesanan pake dhtml n java script....btw nie punya spesifikasi lhow appan eah ???
Spesifikasi dari form ini yaitu :
- field harga, jumlah total, diskon dan jumlah dibayar bersifat read only (disabled).
- Jika field pesan diisi, maka otomatis field jumlah total akan menghitung jumlah total bedasarkan harga dan banyak pesanan yang dimasukkan.
- Field jumlah dibayar juga otomatis terisi berdasarkan perhitungan yang dilakukan.
- Jika pembelian lebih dari 50000 maka field diskon akan otomatis terisi dengan 10000 (tidak berlaku kelipatannya), dan ini nanti akan berpengaruh pada field jumlah dibayar karena nilainya akan berubah sesuai pengurangan diskon.
- Jika button CLEAR di klik maka semua field pesan, jumlah total, diskon dan jumlah dibayat akan dikosongkan.


Trus gimana eah code programnya????
nie lhow code programnya pake, nama file wilis.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"xml:lang="en"lang="en">

<head>
<title>Willys Poenya_Cafe</title>

<script language="JavaScript" type="text/JavaScript">

function hitungpesan() {
var note = document.form1;
var hargaBakso = parseInt(note.bakso.value) * parseInt(note.mybakso.value);
var hargaSoto = parseInt(note.soto.value) * parseInt(note.mysoto.value);
var hargaMie = parseInt(note.mie.value) * parseInt(note.mymie.value);
var hargaDegan = parseInt(note.degan.value) * parseInt(note.mydegan.value);
var hargaCampur = parseInt(note.campur.value) * parseInt(note.mycampur.value);

var hargaTotal= hargaBakso + hargaSoto + hargaMie + hargaDegan + hargaCampur;

if(hargaTotal>50000)
{
note.total.value = hargaTotal;
note.diskon.value = 10000;
note.bayar.value = hargaTotal - parseInt(note.diskon.value);
}
else
{
note.total.value = hargaTotal;
note.diskon.value = 0;
note.bayar.value = hargaTotal;
}
}

function hapus(){
document.form1.reset();
}

function keluar(){
document.form1.exit();
}
</script>
</head>


<font face = "kristen itc" size = "3" color ="orange" left= 600px;>
<h2 align="center">Daftar Pemesanan Willys Poenya _Cafe
<br>Berbasis DHtml dan JavaScript</h2></font></br>
<form name = "form1" action="#">
<table border="1" align="center">


<tr>
<td width="30" align="center" bgcolor="pink"><b>No</b></td>
<td width="200" align="center" bgcolor="pink"><b>Makanan/Minuman</b></td>
<td align="center" bgcolor="pink" ><b>Harga</b></td>
<td align="center" bgcolor="pink"><b>Pesan</b></td>
</tr>

<tr>
<td align="center" bgcolor="pink">1</td>
<td bgcolor="pink">Bakso Istimewa</td>
<td bgcolor="pink">@<input type="text" name="bakso" value="12000" disabled="true"/></td>
<td bgcolor="blue"><input type="text" name="mybakso" value="0" onkeyup="hitungpesan()" /></td>
</tr>

<tr>
<td align="center" bgcolor="pink">2</td>
<td bgcolor="pink">Soto Spesial</td>
<td bgcolor="pink">@<input type="text" name="soto" value="10000" disabled="true"/></td>
<td bgcolor="blue"><input type="text" name="mysoto" value="0" onkeyup="hitungpesan()"/></td>
</tr>

<tr>
<td align="center" bgcolor="pink">3</td>
<td bgcolor="pink">Mie Ayam Super</td>
<td bgcolor="pink">@<input type="text" name="mie" value="15000" disabled="true"/></td>
<td bgcolor="blue"><input type="text" name="mymie" value="0" onkeyup="hitungpesan()"/></td>
</tr>

<tr>
<td align="center" bgcolor="pink">4</td>
<td bgcolor="pink">Es Degan</td>
<td bgcolor="pink">@<input type="text" name="degan" value="5000" disabled="true"/></td>
<td bgcolor="blue"><input type="text" name="mydegan" value="0" onkeyup="hitungpesan()"/></td>
</tr>

<tr>
<td align="center" bgcolor="pink">5</td>
<td bgcolor="pink">Es Campur</td>
<td bgcolor="pink">@<input type="text" name="campur" value="7000" disabled="true"/></td>
<td bgcolor="blue"><input type="text" name="mycampur" value="0" onkeyup="hitungpesan()"/></td>
</tr>

<tr>
<td colspan="3" align="right" bgcolor="pink"><b>Jumlah Total</b></td>
<td bgcolor="blue"><input type="text" name="total" style="text-align:right" disabled="true"/></td>
</tr>

<tr>
<td colspan="3" align="right" bgcolor="pink"><b>Diskon</b></td>
<td bgcolor="blue"><input type="text" name="diskon" style="text-align:right" disabled="true"/></td>
</tr>

<tr>
<td colspan="3" align="right" bgcolor="pink"><b>Jumlah Dibayar</b></td>
<td bgcolor="blue"><input type="text" name="bayar" style="text-align:right" disabled="true"/></td>
</tr>

</table>
<br />

<p>
<font face = "kristen itc" size = "3" color ="purple" left= 600px;>
<br><input type="button" value="DELETE" onclick="hapus()" style="position:absolute; width:100px; height:30px; left: 600px; top: 400px; color : red;" /></br>
</font>
<body background="japan.jpg">
</p>

<font face = "kristen itc" size = "3" color ="purple" left= 600px;>
<h3 align="center" >my.Cafe @2011 Wilis Dwi Probowati Poenya</h3></font>

<a href="cliq.willys282.blogspot.com" color ="purple" left= 600px; >
<h4 align="center" >cliq.willys282.blogspot.com</h4></font>
</form>
</body>
</html>
Ntu gambar diatas merupakan hasil tampilannya guys....
sekarang gimana eah code programnya...coba dueh liatin yg dibawah ini :
File studikasus.js
<script language="JavaScript" type="text/javascript">

<!--

function hitung(){

var myForm = document.form1;

var x=eval(myForm.x.value);

var y=eval(myForm.y.value);

var pil= myForm.opt.value;

if (pil == "tambah") {

    var z = x + y;

 }else if (pil == "kurang") {

    var z = x - y;

 } else if (pil == "kali") {

    var z = x * y;

 } else if (pil == "bagi") {

    var z = x / y;

 }

 myForm.hasil.value = z;

 myForm.x.value = "";

 myForm.y.value = "";

}

function resetForm(){

document.form1.reset();

}


</script>

kemudian nie file studikasus.html
<script language="JavaScript" type="text/javascript">

function hitung(){

var myForm = document.form1;

var x=eval(myForm.x.value);

var y=eval(myForm.y.value);

var pil= myForm.opt.value;

if (pil == "tambah") {

    var z = x + y;

 }else if (pil == "kurang") {

    var z = x - y;

 } else if (pil == "kali") {

    var z = x * y;

 } else if (pil == "bagi") {

    var z = x / y;
 }

 myForm.hasil.value = z;

 myForm.x.value = "";
 myForm.y.value = "";

}

function resetForm(){

document.form1.reset();

}


</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<title>Calculator Willys Ala DHtml dan JavaScript</title>

</head>

<body>

<!-- listing code Javascript-->

<form name="form1" action="#">

<input type="text" name="x" />

<select name="opt">

 <option value="tambah"> + </option>

 <option value="kurang"> - </option>

 <option value="kali"> * </option>

 <option value="bagi"> / </option>

</select>

<input type="text" name="y" />

<input type="button" value="=" onClick="hitung()" />

<input type="text" name="hasil" disabled="true" /><br/>

<br><input type="button"  value="DELETE" onClick="resetForm()" color ="red" /></br>
<body bgcolor="pink">

</form>

</body>

</html>