잘쓰진 않지만 iframe을 이용해서 만들어봄
iframeTestMain.html
중요부분 빨간색 표시
---------------------------------------------------------------------s
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<script>
function fn_sub1(a){
if(a=="m"){
ifmSrc.location.href="iframeTestSub1.php";
}else if(a=='t'){
ifmSrc.location.href="iframeTestSub2.php";
}
}
</script>
<body>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#ccccccc">
<form name="frm">
<tr>
<td bgcolor="#ffffff">
<input type="button" value="모니터" onClick="fn_sub1('m')">
<input type="button" value="TV" onClick="fn_sub1('t')">
</td>
</tr>
<tr>
<td bgcolor="#ffffff">
<iframe id="ifmSrc" src="" border="1" width="300" height="300"></iframe></td>
</tr>
<tr>
<td bgcolor="#ffffff"><input type="text" name="moniterV"></td>
</tr>
<tr>
<td bgcolor="#ffffff"><input type="text" name="tvV"></td>
</tr>
</form>
</table>
</body>
</html>
----------------------------------------------------------------------e
iframeTestSub1.php
----------------------------------------------------------------------s
<meta charset="utf-8">
<?
$moniter=Array("samsung17","samsung18","samsung19","samsung20");
$mCnt=count($moniter);
?>
<script>
function fn_a(){
var f=eval(document.frm);
var mt=f.moniter.value;
var msg="모니터:"+mt;
parent.frm.moniterV.value=msg; //새창의 경우 parent 대신 opener사용
}
</script>
<html>
<body>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#ccccccc" width="200" height="100">
<form name="frm">
<tr>
<td bgcolor="#ffffff">모니터:
<select name="moniter">
<?
for($i=0;$i<$mCnt;$i++){
?>
<option value="<?=$moniter[$i]?>"><?=$moniter[$i]?></option>
<?}?>
</select>
</td>
</tr>
<br>
<tr>
<td bgcolor="#ffffff" align="center"><input type="button" value="적용" onClick="fn_a()"></td>
</td>
</form>
</table>
</body>
</html>
----------------------------------------------------------------------e
iframeTestSub2.php
----------------------------------------------------------------------s
<meta charset="utf-8">
<?
$tv=Array("samsung50","samsung55","samsung60","samsung30");
$tCnt=count($tv);
?>
<script>
function fn_b(){
var f=eval(document.frm);
var tv=f.tv.value;
var msg="Tv : "+tv;
parent.frm.tvV.value=msg;
}
</script>
<html>
<body>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#ccccccc" width="200" height="100">
<form name="frm">
<tr>
<td bgcolor="#ffffff" align="center">Tv:
<select name="tv">
<?
for($i=0;$i<$tCnt;$i++){
?>
<option value="<?=$tv[$i]?>"><?=$tv[$i]?></option>
<?}?>
</select>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="center"><input type="button" value="적용" onClick="fn_b()"></td>
</td>
</tr>
</form>
</table>
</body>
</html>
----------------------------------------------------------------------e
'개발 > html,Thymeleaf' 카테고리의 다른 글
javascript 함수-1 (0) | 2016.01.14 |
---|---|
PHP [phpMyadmin 처럼 만들어 보기] table 검색/insert/update/delete (0) | 2015.10.23 |
php mysql 테이블을 검색/컬럼 및 데이터 출력 (0) | 2015.10.22 |
php maiil 전송/이메일 (0) | 2015.10.19 |
php/html 회원가입 member.php (0) | 2015.10.16 |
댓글