달력

05

« 2012/05 »

  •  
  •  
  • 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
  •  
  •  

'tip/javascript'에 해당되는 글 3

  1. 2009/05/06 div태그로 지정된 영역만 출력
  2. 2009/03/11 iframe 사이즈 자동조절
  3. 2009/03/03 HTML 간단한 새창 띄우기
2009/05/06 13:26

div태그로 지정된 영역만 출력 tip/javascript2009/05/06 13:26

미리보기로만 예제를 보실 수 있습니다.
 
1
<html> 
<head> 
    <title>http://www.blueb.co.kr</title> 
     
<script type="text/javascript"> 
  var win=null; 
  function printIt(printThis)  { 
    win = window.open(); 
    self.focus(); 
    win.document.open(); 
    win.document.write('<'+'html'+'><'+'head'+'><'+'style'+'>'); 
    win.document.write('body, td { font-family: Verdana; font-size: 10pt;}'); 
    win.document.write('<'+'/'+'style'+'><'+'/'+'head'+'><'+'body'+'>'); 
    win.document.write(printThis); 
    win.document.write('<'+'/'+'body'+'><'+'/'+'html'+'>'); 
    win.document.close(); 
    win.print(); 
    win.close(); 
  } 
</script> 
</head> 
<body> 

<a href="javascript:printIt(document.getElementById('printme').innerHTML)">Print</a><p> 

<div id="printme"> 
이 부분만 출력</div> 


</body> 
</html>

'tip > javascript' 카테고리의 다른 글

div태그로 지정된 영역만 출력  (0) 2009/05/06
iframe 사이즈 자동조절  (0) 2009/03/11
HTML 간단한 새창 띄우기  (0) 2009/03/03
Posted by 根™
2009/03/11 16:02

iframe 사이즈 자동조절 tip/javascript2009/03/11 16:02

1.아래 코드를 아이프레임이 들어갈 메인페이지에 삽입세요.

function resizeFrame(iframeObj){
  var innerBody = iframeObj.contentWindow.document.body;
  var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
  var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
 
    if(innerHeight>0 && innerWidth>0){
        iframeObj.style.height = innerHeight;
        iframeObj.style.width = innerWidth;
    }
}

2. 아래와 같이 iframe을 호출하는 부분에서 onload 이벤트에서 호출하면 끝!.

<iframe src="" name="iPub_list" onload="resizeFrame(this)" style="width:100%" frameborder="0" scrolling="no"></iframe>

'tip > javascript' 카테고리의 다른 글

div태그로 지정된 영역만 출력  (0) 2009/05/06
iframe 사이즈 자동조절  (0) 2009/03/11
HTML 간단한 새창 띄우기  (0) 2009/03/03
Posted by 根™
2009/03/03 03:59

HTML 간단한 새창 띄우기 tip/javascript2009/03/03 03:59

head에 script 필요없이 body에서 바로바로 사용할 수 있어서 좋다.
또한 여러개의 창을 띄울때도 유용하게 쓰인다. ^^*

<a href="#" onclick="window.open('./lib_construction.jsp', '_blank', 'width=800 height=300')"></a>

'tip > javascript' 카테고리의 다른 글

div태그로 지정된 영역만 출력  (0) 2009/05/06
iframe 사이즈 자동조절  (0) 2009/03/11
HTML 간단한 새창 띄우기  (0) 2009/03/03
TAG html, 새창
Posted by 根™