membuat pop up window sederhana menggunakan javascript

pop up window mengirim object dari child ke parent

q> File popup1.html (sebagai parent)

function buka(){'popup2.html','','width=640,height=480,menubar=yes,location=yes,scrollbars=yes,resizeable=yes,status=yes,copyhistiry=ho,toolbar=no')
<FORM name="formname">
<td>Id Kecamatan</td><td>:</td><td><INPUT TYPE="text" NAME="id_kec"></td><td><input type="submit" value="LOV" onclick="buka()"></td>
<td>Nama Kecamatan</td><td>:</td><td><INPUT TYPE="text" NAME="nama_kec"></td><td>&nbsp;</td>

q> File popup2.html (sebagai child)

<script language="javascript">

function addRowHandlers() {
var table = document.getElementById("tableId");
var rows = table.getElementsByTagName("tr");
for (i = 0; i < rows.length; i++) {
var currentRow = table.rows[i];
var createClickHandler =
return function() {
var cell = row.getElementsByTagName("td")[0];
var cell2 = row.getElementsByTagName("td")[1];
var kolom1 = cell.innerHTML;
var kolom2 = cell2.innerHTML;

currentRow.onclick = createClickHandler(currentRow);
<BODY onload="addRowHandlers()">
Master Kecamatan
<table id="tableId">
<tr bgcolor="cccccc"><td>DS</td><td>Daha Selatan</td></tr>
<tr><td>DU</td><td>Daha Utara</td></tr>
<tr bgcolor="cccccc"><td>DB</td><td>Daha Barat</td></tr>
<tr><td>PB</td><td>Padang Batung</td></tr>
<tr bgcolor="cccccc"><td>AG</td><td>Angkinang</td></tr>
<tr bgcolor="cccccc"><td>TL</td><td>Telaga Langsat</td></tr>

Published by


Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s