본문 바로가기

컴퓨터/언어,프로그래밍

[JavaScript] 아이프레임 링크 관련 소스

function xlink(E,URL)
{
 
  switch(E)
  {
  case 'new': window.open( URL,'new','left=100, top=100, width=640, height=480, resizable, directories, location, menubar, scrollbars, toolbar, status');
    break;
  case 'parent':
    parent.document.location.href = URL;
    break;
  case 'iframe_document_write':

    var imgtarget = window.open('','iframe_name_main');
        imgtarget.document.open();
        imgtarget.document.write('<a href="http://weezzle.net/">aaa');
        imgtarget.document.write('</a>');
        imgtarget.document.close();
    break;
    
  case 'iframe_link' :
    document.iframe_name_main.location.href = URL;
    break;
    
  default:
    document.location.href = URL;
    break;
  }
}

function xIFrameSize () {
 try
 { 
  var iframeElement = xGetElementById('iframe');

  if(iframeElement==null) return;
  if (iframeElement.contentDocument && iframeElement.contentDocument.body.offsetHeight) { //ns6 syntax
   iframeElement.style.height =iframeElement.contentDocument.body.offsetHeight+50+'px';
  } else if (iframeElement.Document && iframeElement.Document.body.scrollHeight) { //ie5+ syntax
   iframeElement.style.height =iframeElement.Document.body.scrollHeight+50+'px';
  } else {
   iframeElement.style.height = 1000+'px';
  }
 } catch(e) {}
}


----------------------------

function Button_Press_Event(value) { xlink('iframe_link','http://weezzle.net'); }

------------------------------

<select name="Posting_Site_Name" size="5" onclick="Button_Press_Event(this.value);">
                    <option selected value="aaa">[AAA]</option>
</select>

제주삼다수, 2L,... 오뚜기 진라면 매운... 상하목장 유기농 흰... 남양 프렌치카페 카... 고려인삼유통 홍삼 ... 종근당건강 오메가3... 요이치 카링 유무선...