티스토리 툴바

블로그 이미지
Dan Dan Webper

카테고리

Hestroy (7)
프로그램 이야기 (4)
디자인 이야기 (0)
인생 이야기 (1)
도움이 되는 이야기 (0)
잡담 (1)
막장 리뷰 (0)
촉촉한 (0)
작업중 (1)
기타와음악 (0)
Total1,648
Today0
Yesterday1

달력

« » 2012.01
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

function moveDualList( srcList, destList, moveAll ) {


if ( ( srcList.selectedIndex == -1 ) && ( moveAll == false ) ) {
return;
}

newDestList = new Array( destList.options.length );
var len = 0;

for( len = 0; len < destList.options.length; len++ ) {
if ( destList.options[ len ] != null ) {
newDestList[ len ] = new Option( destList.options[ len ].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
}
}

for( var i = 0; i < srcList.options.length; i++ ) {
if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) ) {
newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );
len++;
}
}

newDestList.sort( compareOptionValues ); // BY VALUES
for ( var j = 0; j < newDestList.length; j++ ) {
if ( newDestList[ j ] != null ) {
destList.options[ j ] = newDestList[ j ];
}
}
for( var i = srcList.options.length - 1; i >= 0; i-- ) {
if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) ) {
srcList.options[i] = null;
}
}
Movechek(); // 이동시 마다 함수 저장
}

function Movechek(){
 tmpStr = document.hp_list.htm_vehicle.value;
 var leno = document.forms['hp_list'].elements['htm_vehicle'].options.length; // 셀렉트 박스 갯수
 var strValues = "";
 var count = 0;
 for(i=0; i<leno; i++)
 {
  //strValues = document.forms['hp_list'].elements['htm_vehicle'].options[I].value;
 if (count == 0) {
 strValues = document.forms['hp_list'].elements['htm_vehicle'].options[i].value;
 }
 else {
 strValues = strValues + "," + document.forms['hp_list'].elements['htm_vehicle'].options[i].value;
    }
 count++;
 }
 if(strValues ==  "") alert('빈값');
 else parent.doSearch(strValues);
}

          자식 페이지 스크립트 ▲

         

<form name ="hp_list">
<table style="border" style="border:solid 1 gray;font-family:Tahoma,Verdana,Arial;font-size:8pt;color:black;background-color:#f6f6f6;" >
<tr>
<td bgcolor="#e8e8e8">
<!-- vehicle list will be filled by model year selection -->
<select multiple size="6" style="width:200" name="available">
<?
 $sql="select * from directory where `directory`.`group` ='$click_day' order by idx";
     $result=mysql_query($sql);
       for($k=0;$k<$row=sql_fetch_array($result);$k++)
    {
?>
<option value="<?=$row[directory_num];?>"><?=$row[directory_name]." ".$row[directory_num];?>
<?
}
?>

</select>
</td>
<td bgcolor="#e8e8e8" xwidth="15%" align="center">
<input type="button" style="width:50" onClick="moveDualList( this.form.available, this.form.htm_vehicle, false )" value=">" id=button2 name=button2><br>
<input type="button" style="width:50" onClick="moveDualList( this.form.htm_vehicle, this.form.available, false )" value="<" id=button3 name=button3><br>
<input type="button" style="width:50" onClick="moveDualList( this.form.available, this.form.htm_vehicle, true )" value=">>" id=button4 name=button4><br>
<input type="button" style="width:50" onClick="moveDualList( this.form.htm_vehicle, this.form.available, true )" value="<<" id=button5 name=button5><br>
</td>
<td bgcolor="#e8e8e8">
<select multiple size="6" style="width:180" name="htm_vehicle">
</select>
</td>
</form>
</table>

           자식 페이지 Html ▲

 function doSearch(hp_num) // 자식값 받아오기
   {
    document.sms.hp_num.value = hp_num;
  }
            부모 스크립트 ▲

정리 =

이소스는 한페이지 안에 2페이지가 있다 (iframe)

자식에서 이벤트가 일어 날때마다 부모 함수 안에 저장해서

최종적으로 부모가 다른 페이지로 값을 넘길때 다같이 보낼수 있도록 했다

(설명이 어렵네..ㅋ)




      
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by Dan; 달달한 그이야기 Webper

최근에 달린 댓글

최근에 받은 트랙백

글 보관함