'작업노트/HTML & Script'에 해당되는 글 17건

  1. 2008.02.02 전체선택을 위한 자바스크립트 코드
  2. 2008.01.05 아이프레임 리사이즈 문제 해법
  3. 2007.09.15 name과 id의 차이
  4. 2007.09.04 GET방식으로 한글 보내는 방법
  5. 2007.08.29 innerHTML을 사용할 시에
  6. 2007.07.17 서블릿을 이용할때 iframe resize가 안되는 경우.. 1
  7. 2007.05.31 HTML 객체 계층도

전체선택을 위한 자바스크립트 코드

|

<script type="text/javascript">
function select_all() {
 var all = document.getElementById("selectAll");
 var list = document.getElementsByName("checkList[]");
 
 if(!all.checked) {//전체선택 체크박스가 해제되었다면
  for(var i = 0; i <= list .length - 1 ; i++) {//모든 체크박스를 체크해제
   list[i].checked = false;
  }
 } else { //그게 아니라면
  for(var i = 0; i <= list .length - 1 ; i++) {
   list [i].checked = true;//모든 체크박스를 체크
  }
 }  
}
</script>


.......................................
<tr>
    <td>
        <input type="checkbox" name="selectAll" onClick="select_all()">          
    </td>
</tr>
<tr>
    <td>
        <input type="checkbox" name="checkList[]" value="딸기">
        <input type="checkbox" name="checkList[]" value="사과">
        <input type="checkbox" name="checkList[]" value="배">
        <input type="checkbox" name="checkList[]" value="귤">
<!-- 자바 struts 사용시 ActionForm에서 array로 받으려면  '[]' 이녀석을 꼭 붙여줘야 한다.-->
    </td>
<tr>
....................................

원래 코드에서 수정하고 테스트는 안해보았음.

And

아이프레임 리사이즈 문제 해법

|

How To Resize an IFrame to the Size of Its Contents Without Displaying Scroll Bars

Article ID : 278469
Last Review : November 23, 2006
Revision : 4.1
This article was previously published under Q278469

SUMMARY

In certain situations, you may want to resize an IFrame so that all of its document contents are visible, but no scroll bars are displayed on the page. This article describes how to do this.

Back to the top

MORE INFORMATION

To determine the size of the IFrame's contents, you must access the height and width properties of the underlying IFrame document. Because you only have scripting access to pages that are hosted in the same domain, you can only access the properties to the pages that are hosted within the same domain (for example, Cross Frame Scripting). Therefore, the source document of the IFrame must be from the same domain as the page that contains the IFrame.

The following code demonstrates how to resize an IFrame in this way. Create a new .htm document, and paste the following HTML code. In the SRC attribute for the IFrame, you must supply an HTML page from the same domain that the IFrame loads.

NOTE: This technique may not work correctly if there are absolutely positioned elements that are residing within the IFrame.
<HTML>
<HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function reSize()
{
	try{	
	var oBody	=	ifrm.document.body;
	var oFrame	=	document.all("ifrm");
		
	oFrame.style.height = oBody.scrollHeight + 
(oBody.offsetHeight - oBody.clientHeight); oFrame.style.width = oBody.scrollWidth +
(oBody.offsetWidth - oBody.clientWidth); } //An error is raised if the IFrame domain !=
its container's domain catch(e) { window.status = 'Error: ' + e.number + '; ' + e.description; } } //--> </SCRIPT> </HEAD> <BODY onload=reSize()> <iframe onresize=reSize() id=ifrm src=YOUR_PAGE_HERE></iframe> </BODY> </HTML>
This example uses try and catch to check for domain consistency, which are only available with Internet Explorer 5 and later. This error checking is included for illustration purposes and is not absolutely necessary; it only allows the script to fail gracefully.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site:
https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104)
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)

Back to the top

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
167796 (http://support.microsoft.com/kb/167796/EN-US/) PRB: Permission Denied Error Message When Scripting Across Frame
For more information about measuring element dimensions and locations, see the following Microsoft Developer Network (MSDN) Web site:
http://msdn.microsoft.com/workshop/author/om/measuring.asp (http://msdn.microsoft.com/workshop/author/om/measuring.asp)
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
http://msdn.microsoft.com/ie/ (http://msdn.microsoft.com/ie/)

http://support.microsoft.com/iep (http://support.microsoft.com/iep)

Back to the top

And

name과 id의 차이

|
name : 서버스크립트에서 주로 사용된다.
id : 자바스크립트같은 클라이언트사이드 스크립트에서 주로 사용된다.

자세한 내용은...
http://user.chollian.net/~spacekan/source/form/useForm.htm#useForm2
And

GET방식으로 한글 보내는 방법

|
자바스크립트를 이용해야 했기 때문에

var encodedUrl = encodeURIComponent(url);
var encodedName = encodeURIComponent(name);

이런식으로 해서 보냈더니 해결되었다.

(ps. ajax사용...)
And

innerHTML을 사용할 시에

|

타겟으로 사용되는 <div>태그에 제대로 내용이 나타나지 않았는데,

<tr><td>로 묶어주니 제대로 표현이 되었다.

<tr><td>
      <div id="photos"> </div>
  </td></tr>

이런식으로.

And

서블릿을 이용할때 iframe resize가 안되는 경우..

|
외부에서 서블릿.do?action=액션명 이런식으로 접근할 필요가 생겼다. 그런데..

인터넷에 돌고 있는 아이프레임의 리사이즈 함수들은
서블릿을 통해 부모페이지가 로드될경우 리사이즈 되지가 않는다.
(왜그런지는 모르겠으나.. 크기를 제대로 잡지 못한다.)


<script>
    var ifrContentsTimer;
    function resizeRetry() { //로딩 완료후 다시한번 리사이즈
    if(document.body.readyState == "complete") {
    clearInterval(ifrContentsTimer);
    } else {
    resizeFrame();
    }
    }
   
    function resizeFrame(){ //로딩 즉시 리사이즈
    self.resizeTo(document.body.scrollWidth + (document.body.offsetWidth-document.body.clientWidth), parseInt(document.body.scrollHeight)+10);
    }
</script>


<body onload="resizeFrame();ifrContentsTimer = setInterval('resizeRetry()', 100);">


아이프레임에 들어갈 문서(자식 페이지)에 위 내용을 추가/수정한다.
아마도 서블릿 매핑하는 과정이 오래걸려서?? 로딩이 완료되지 않은 상태로
리사이즈 되는 모냥이다.

'작업노트 > HTML & Script' 카테고리의 다른 글

아이프레임 리사이즈 문제 해법  (0) 2008.01.05
name과 id의 차이  (0) 2007.09.15
GET방식으로 한글 보내는 방법  (0) 2007.09.04
innerHTML을 사용할 시에  (0) 2007.08.29
HTML 객체 계층도  (0) 2007.05.31
And

HTML 객체 계층도

|
사용자 삽입 이미지


And
prev | 1 | 2 | next