달력

52024  이전 다음

  • 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
반응형

출처 : http://ojtiger.com/179


브라우저가 HTML파일을 읽어오는 순서


반응형
Posted by 친절한 웬디양~ㅎㅎ
|
반응형

<script type="text/javascript">

...

jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
    this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
    return this;
}

...

 

showPopup = function() {

$("#popLayer").show();

$("#popLayer").center();

}

 

</script>

 

<body>

...

 

<a href="javascript:;" onclick="javascript:showPopup()">팝업띄우기</a>

 

...

</body>

 

<div id="popLayer" style="display:none;">

<div>팝업 레이어입니다.</div>

<div>

 코드 출처 : http://stackoverflow.com/questions/210717/using-jquery-to-center-a-div-on-the-screen

출처 : http://ooz.co.kr/78

반응형
Posted by 친절한 웬디양~ㅎㅎ
|
반응형

출처 : http://egloos.zum.com/tiger5net/v/5667935



JQuery에 다른 기능을 검색하다가 아래의 사이트를 발견하여 나중에 도움이 될 듯하여 정리해둔다.


1. jQuery로 선택된 값 읽기

 

$("#selectBox option:selected").val();

$("select[name=name]").val();

 

2. jQuery로 선택된 내용 읽기

 

$("#selectBox option:selected").text();

 

3. 선택된 위치

 

var index = $("#test option").index($("#test option:selected"));

 

4. Add options to the end of a select

 

$("#selectBox").append("<option value='1'>Apples</option>");

$("#selectBox").append("<option value='2'>After Apples</option>");

 

5. Add options to the start of a select

 

$("#selectBox").prepend("<option value='0'>Before Apples</option>");

 

6. Replace all the options with new options

 

$("#selectBox").html("<option value='1'>Some oranges</option><option value='2'>MoreOranges</option>");

 

7. Replace items at a certain index

 

$("#selectBox option:eq(1)").replaceWith("<option value='2'>Someapples</option>");

$("#selectBox option:eq(2)").replaceWith("<option value='3'>Somebananas</option>");

 

8. 지정된 index값으로 select 하기

 

$("#selectBox option:eq(2)").attr("selected", "selected");

 

9. text 값으로 select 하기

 

$("#selectBox").val("Someoranges").attr("selected", "selected");

 

10. value값으로 select 하기

 

$("#selectBox").val("2");

 

11. 지정된 인덱스값의 item 삭제

 

$("#selectBox option:eq(0)").remove();

 

12. 첫번째 item 삭제

 

$("#selectBox option:first").remove();

 

13. 마지막 item 삭제

 

$("#selectBox option:last").remove();

 

14. 선택된 옵션의 text 구하기

 

alert(!$("#selectBox option:selected").text());

 

15. 선택된 옵션의 value 구하기

 

alert(!$("#selectBox option:selected").val());

 

16. 선택된 옵션 index 구하기

 

alert(!$("#selectBox option").index($("#selectBox option:selected")));

 

17. SelecBox 아이템 갯수 구하기

 

alert(!$("#selectBox option").size());

 

18. 선택된 옵션 앞의 아이템 갯수

 

alert(!$("#selectBox option:selected").prevAl!l().size());

 

19. 선택된 옵션 후의 아이템 갯수

 

alert(!$("#selectBox option:selected").nextAll().size());

 

20. Insert an item in after a particular position

 

$("#selectBox option:eq(0)").after("<option value='4'>Somepears</option>");

 

21. Insert an item in before a particular position

 

$("#selectBox option:eq(3)").before("<option value='5'>Someapricots</option>");

 

22. Getting values when item is selected

 

$("#selectBox").change(function(){

           alert(!$(this).val());

           alert(!$(this).children("option:selected").text());

});


출처 : http://blog.daum.net/twinsnow/124



반응형
Posted by 친절한 웬디양~ㅎㅎ
|
반응형

http://cflove.org/2010/05/simple-jquery-textarea-maxlength-function.cfm 참조 


 

<script type='text/javascript' src='http://cflove.org/js/jquery-1.4.2.min.js'></script>
<script type="text/javascript"> 

 $("document").ready(function() { 
  $('textarea[maxlength]').live('keyup change', function() { 
   var str = $(this).val() 
   var mx = parseInt($(this).attr('maxlength')) 
   if (str.length > mx) { 
    $(this).val(str.substr(0, mx));
     return false; 
    } 
  }) 
 }) 

</script>

 

 <textarea maxlength="50" style="width:400px; height:50px"></textarea> 

 

 

반응형
Posted by 친절한 웬디양~ㅎㅎ
|

JQuery api url

Develope/jQuery 2015. 1. 2. 15:54
반응형
반응형
Posted by 친절한 웬디양~ㅎㅎ
|
반응형
반응형
Posted by 친절한 웬디양~ㅎㅎ
|
반응형

 [참고] 관련 포스트

 

[jQuery Plugin] jQuery Multiple File Upload Plugin - 멀티 파일 업로드 (jQuery MultiFile v2.0.3) 

 

[jsp/servlet] commons-fileupload 를 이용한 파일업로드 (서블릿)  

[jQuery Plugin/ajax] jQuery Form Plugin 이용한 ajax 파일 업로드 [서버사이드: Servlet (commons-fileupload API)]  

[Ajax] FormData를 사용하여 form 정보 전송하기 

 jQuery Multiple File Upload Plugin​ Site : 

jQuery MultiFile v2.0.3 : http://www.fyneworks.com/jquery/multifile/​ 

jQuery Multiple File Upload Plugin v1.48 : http://www.fyneworks.com/jquery/multiple-file-upload/

 

 

서버사이드 작업은 여기서 생략하도록 하겠습니다. 

기존 포스트 및 첨부된 프로젝트 소스를 참고하세요! 

[jsp/servlet] jQuery Form Plugin 이용한 ajax 파일 업로드 (다운로드 처리 추가) [서버사이드: Servlet (commons-fileupload API)] 

 

 [코드] multifileExam01.html

Colored By Color Scripter

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jquery-ajax-form-submit/</title>
<!-- jQuery import -->
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<!-- jQuery Form Plugin import -->
<script src="js/jquery.form.min.js"></script>
<!-- jQuery MultiFile Plugin import -->
<script src="js/jQuery.MultiFile.min.js"></script>

<script>
$(document).ready(function(){
    
    //use jQuery MultiFile Plugin 
    $('#multiform input[name=photo]').MultiFile({
        max: 3, //업로드 최대 파일 갯수 (지정하지 않으면 무한대)
        accept: 'jpg|png|gif'//허용할 확장자(지정하지 않으면 모든 확장자 허용)
        maxfile: 1024, //각 파일 최대 업로드 크기
        maxsize: 3024,  //전체 파일 최대 업로드 크기
        STRING: { //Multi-lingual support : 메시지 수정 가능
            remove : "제거"//추가한 파일 제거 문구, 이미태그를 사용하면 이미지사용가능
            duplicate : "$file 은 이미 선택된 파일입니다."
            denied : "$ext 는(은) 업로드 할수 없는 파일확장자입니다.",
            selected:'$file 을 선택했습니다.'
            toomuch: "업로드할 수 있는 최대크기를 초과하였습니다.($size)"
            toomany: "업로드할 수 있는 최대 갯수는 $max개 입니다.",
            toobig: "$file 은 크기가 매우 큽니다. (max $size)"
        },
        list:"#afile3-list" //파일목록을 출력할 요소 지정가능
    });
});
</script>
</head>
<body>

<h3>jQuery ajax fileupload (ajax 파일업로드)</h3>
<form name="multiform" id="multiform" action="FileUploadServlet"
                                      method="POST" enctype="multipart/form-data">

    
    title: <input type="text" name="title"  value=""/> <br/>
    description :<input type="text" name="description"  value="" /> <br/>
    
    <!-- 다중 파일업로드  -->
    photo : <input type="file" class="afile3"  name="photo" />
    <div id="afile3-list" style="border:2px solid #c9c9c9;min-height:50px"></div> 
    
    <input type="submit" id="btnSubmit" value="전송"/><br/>
</form>    

<div id="result"></div>


<script>

/*jQuery form 플러그인을 사용하여 폼데이터를 ajax로 전송*/

var downGroupCnt =0; //다운로드그룹 개수카운트

$(function(){
    
    //폼전송 : 해당폼의 submit 이벤트가 발생했을경우 실행  
    $('#multiform').ajaxForm({
       cache: false,
       dataType:"json",
       //보내기전 validation check가 필요할경우
       beforeSubmit: function (data, frm, opt) {
           //console.log(data);
           alert("전송전!!");
           return true;
       },
       //submit이후의 처리
       success: function(data, statusText){
           
           alert("전송성공!!");
           console.log(data); //응답받은 데이터 콘솔로 출력         
           
           output(data); //받은 정보를 화면 출력하는 함수 호출
       },
       //ajax error
       error: function(e){
           alert("에러발생!!");
           console.log(e);
       }                               
    });
});

//전달받은 정보를 가지고 화면에 보기 좋게 출력
function output(data) {
    //업로드한 파일을 다운로드할수있도록 화면 구성
    $("#result").append("<h3>("+(++downGroupCnt)+") 다운로드</h3>");
    $("#result").append("제목:"+data.title+"<br/>");
    $("#result").append("설명:"+data.description+"<br/>");
  
    if(data.photo){
        $("#result").append("포토:<br/>");           
        $.each(data.photo, function(index, item){
            var link = "FileDownload?f="+item.uploadedFileName+"&of="+item.fileName;
            $("#result").append("<a href='"+ link +"' download>"+item.fileName+"</a>");
            $("#result").append("<br/>");                   
        });
    }           
     /*
     if(data.file){
        var link = "FileDownload?f="+data.file.uploadedFileName+"&of="+data.file.fileName;
        $("#result").append("파일 :<a href='"+ link +"' download>"+data.file.fileName+"</a>");
        $("#result").append("<br/>");
    } */

    
    $('#multiform')[0].reset(); //폼 초기화(리셋); 
    $('#multiform input:file').MultiFile('reset'); //멀티파일 초기화        
}
</script>

</body>
</html>

 

 





 

 

Ajax 

 

jQuery Form Plugin​ 을 사용해서 비동기방식(Ajax)으로 업로드한후 file input컨트롤을 리셋 하는 방법!?

To reset the file selections, just make the following call:

 $('input:file').MultiFile('reset') 

 

 

 

[기타 잡담]

 

Multiple File Upload jQuery Plugin​ 2.1.0 버전부터는 이미지파일을 업로드 추가했을경우 이미지 미리보기를 지원하는것 같다. 

 

예제: http://jsfiddle.net/fyneworks/2LLws/ 

Multiple File Upload jQuery Plugin​ 2.1.0 버전 : https://rawgit.com/fyneworks/multifile/2.1.0-preview/jquery.MultiFile.js 

 

 <input type="file" class="multi with-preview" multiple />

 

 

반응형
Posted by 친절한 웬디양~ㅎㅎ
|

Accordion Widget

Develope/jQuery 2014. 6. 2. 14:45
반응형

출처 : http://api.jqueryui.com/accordion/

제가 쓴건...


      $(function () {

          $("#accordion").accordion({collapsible:true});

   $("#accordion").accordion("option", "animate", 100);

      });


요거...


아래는 api 내용..ㅎㅎ


ccordion Widgetversion added: 1.0

Description: Convert a pair of headers and content panels into an accordion.

QuickNavExamples

The markup of your accordion container needs pairs of headers and content panels:

1
2
3
4
5
6
<div id="accordion">
<h3>First header</h3>
<div>First content panel</div>
<h3>Second header</h3>
<div>Second content panel</div>
</div>

Accordions support arbitrary markup, but each content panel must always be the next sibling after its associated header. See the header option for information on how to use custom markup structures.

The panels can be activated programmatically by setting the active option.

Keyboard interaction

When focus is on a header, the following key commands are available:

  • UP/LEFT - Move focus to the previous header. If on first header, moves focus to last header.
  • DOWN/RIGHT - Move focus to the next header. If on last header, moves focus to first header.
  • HOME - Move focus to the first header.
  • END - Move focus to the last header.
  • SPACE/ENTER - Activate panel associated with focused header.

When focus is in a panel:

  • CTRL+UP: Move focus to associated header.

Theming

The accordion widget uses the jQuery UI CSS framework to style its look and feel. If accordion specific styling is needed, the following CSS class names can be used:

  • ui-accordion: The outer container of the accordion.
    • ui-accordion-header: The headers of the accordion. The headers will additionally have a ui-accordion-icons class if they contain icons.
    • ui-accordion-content: The content panels of the accordion.

Dependencies

Additional Notes:

  • This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point.

Options

activeType: Boolean or Integer

Default: 0
Which panel is currently open.
Multiple types supported:
  • Boolean: Setting active to false will collapse all panels. This requires the collapsible option to be true.
  • Integer: The zero-based index of the panel that is active (open). A negative value selects panels going backward from the last panel.
Code examples:

Initialize the accordion with the active option specified:

1
$( ".selector" ).accordion({ active: 2 });

Get or set the active option, after initialization:

1
2
3
4
5
// getter
var active = $( ".selector" ).accordion( "option", "active" );
// setter
$( ".selector" ).accordion( "option", "active", 2 );

animateType: Boolean or Number or String or Object

Default: {}
If and how to animate changing panels.
Multiple types supported:
  • Boolean: A value of false will disable animations.
  • Number: Duration in milliseconds with default easing.
  • String: Name of easing to use with default duration.
  • Object: Animation settings with easing and duration properties.
    • Can also contain a down property with any of the above options.
    • "Down" animations occur when the panel being activated has a lower index than the currently active panel.
Code examples:

Initialize the accordion with the animate option specified:

1
$( ".selector" ).accordion({ animate: 200 });

Get or set the animate option, after initialization:

1
2
3
4
5
// getter
var animate = $( ".selector" ).accordion( "option", "animate" );
// setter
$( ".selector" ).accordion( "option", "animate", 200 );

collapsibleType: Boolean

Default: false
Whether all the sections can be closed at once. Allows collapsing the active section.
Code examples:

Initialize the accordion with the collapsible option specified:

1
$( ".selector" ).accordion({ collapsible: true });

Get or set the collapsible option, after initialization:

1
2
3
4
5
// getter
var collapsible = $( ".selector" ).accordion( "option", "collapsible" );
// setter
$( ".selector" ).accordion( "option", "collapsible", true );

disabledType: Boolean

Default: false
Disables the accordion if set to true.
Code examples:

Initialize the accordion with the disabled option specified:

1
$( ".selector" ).accordion({ disabled: true });

Get or set the disabled option, after initialization:

1
2
3
4
5
// getter
var disabled = $( ".selector" ).accordion( "option", "disabled" );
// setter
$( ".selector" ).accordion( "option", "disabled", true );

eventType: String

Default: "click"
The event that accordion headers will react to in order to activate the associated panel. Multiple events can be specified, separated by a space.
Code examples:

Initialize the accordion with the event option specified:

1
$( ".selector" ).accordion({ event: "mouseover" });

Get or set the event option, after initialization:

1
2
3
4
5
// getter
var event = $( ".selector" ).accordion( "option", "event" );
// setter
$( ".selector" ).accordion( "option", "event", "mouseover" );

headerType: Selector

Default: "> li > :first-child,> :not(li):even"

Selector for the header element, applied via .find() on the main accordion element. Content panels must be the sibling immediately after their associated headers.

Code examples:

Initialize the accordion with the header option specified:

1
$( ".selector" ).accordion({ header: "h3" });

Get or set the header option, after initialization:

1
2
3
4
5
// getter
var header = $( ".selector" ).accordion( "option", "header" );
// setter
$( ".selector" ).accordion( "option", "header", "h3" );

heightStyleType: String

Default: "auto"

Controls the height of the accordion and each panel. Possible values:

  • "auto": All panels will be set to the height of the tallest panel.
  • "fill": Expand to the available height based on the accordion's parent height.
  • "content": Each panel will be only as tall as its content.
Code examples:

Initialize the accordion with the heightStyle option specified:

1
$( ".selector" ).accordion({ heightStyle: "fill" });

Get or set the heightStyle option, after initialization:

1
2
3
4
5
// getter
var heightStyle = $( ".selector" ).accordion( "option", "heightStyle" );
// setter
$( ".selector" ).accordion( "option", "heightStyle", "fill" );

iconsType: Object

Default: { "header": "ui-icon-triangle-1-e", "activeHeader": "ui-icon-triangle-1-s" }

Icons to use for headers, matching an icon provided by the jQuery UI CSS Framework. Set to false to have no icons displayed.

  • header (string, default: "ui-icon-triangle-1-e")
  • activeHeader (string, default: "ui-icon-triangle-1-s")
Code examples:

Initialize the accordion with the icons option specified:

1
$( ".selector" ).accordion({ icons: { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" } });

Get or set the icons option, after initialization:

1
2
3
4
5
// getter
var icons = $( ".selector" ).accordion( "option", "icons" );
// setter
$( ".selector" ).accordion( "option", "icons", { "header": "ui-icon-plus", "activeHeader": "ui-icon-minus" } );

Methods

destroy()Returns: jQuery (plugin only)

Removes the accordion functionality completely. This will return the element back to its pre-init state.
  • This method does not accept any arguments.
Code examples:

Invoke the destroy method:

1
$( ".selector" ).accordion( "destroy" );

disable()Returns: jQuery (plugin only)

Disables the accordion.
  • This method does not accept any arguments.
Code examples:

Invoke the disable method:

1
$( ".selector" ).accordion( "disable" );

enable()Returns: jQuery (plugin only)

Enables the accordion.
  • This method does not accept any arguments.
Code examples:

Invoke the enable method:

1
$( ".selector" ).accordion( "enable" );

option( optionName )Returns: Object

Gets the value currently associated with the specified optionName.
  • optionName
    Type: String
    The name of the option to get.
Code examples:

Invoke the method:

1
var isDisabled = $( ".selector" ).accordion( "option", "disabled" );

option()Returns: PlainObject

Gets an object containing key/value pairs representing the current accordion options hash.
  • This signature does not accept any arguments.
Code examples:

Invoke the method:

1
var options = $( ".selector" ).accordion( "option" );

option( optionName, value )Returns: jQuery (plugin only)

Sets the value of the accordion option associated with the specified optionName.
  • optionName
    Type: String
    The name of the option to set.
  • value
    Type: Object
    A value to set for the option.
Code examples:

Invoke the method:

1
$( ".selector" ).accordion( "option", "disabled", true );

option( options )Returns: jQuery (plugin only)

Sets one or more options for the accordion.
  • options
    Type: Object
    A map of option-value pairs to set.
Code examples:

Invoke the method:

1
$( ".selector" ).accordion( "option", { disabled: true } );

refresh()Returns: jQuery (plugin only)

Process any headers and panels that were added or removed directly in the DOM and recompute the height of the accordion panels. Results depend on the content and the heightStyle option.
  • This method does not accept any arguments.
Code examples:

Invoke the refresh method:

1
$( ".selector" ).accordion( "refresh" );

widget()Returns: jQuery

Returns a jQuery object containing the accordion.
  • This method does not accept any arguments.
Code examples:

Invoke the widget method:

1
var widget = $( ".selector" ).accordion( "widget" );

Events

activate( event, ui )Type: accordionactivate

Triggered after a panel has been activated (after animation completes). If the accordion was previously collapsed, ui.oldHeader and ui.oldPanel will be empty jQuery objects. If the accordion is collapsing, ui.newHeader and ui.newPanel will be empty jQuery objects.

Note: Since the activate event is only fired on panel activation, it is not fired for the initial panel when the accordion widget is created. If you need a hook for widget creation use the create event.
  • event
    Type: Event
  • ui
    Type: Object
    • newHeader
      Type: jQuery
      The header that was just activated.
    • oldHeader
      Type: jQuery
      The header that was just deactivated.
    • newPanel
      Type: jQuery
      The panel that was just activated.
    • oldPanel
      Type: jQuery
      The panel that was just deactivated.
Code examples:

Initialize the accordion with the activate callback specified:

1
2
3
$( ".selector" ).accordion({
activate: function( event, ui ) {}
});

Bind an event listener to the accordionactivate event:

1
$( ".selector" ).on( "accordionactivate", function( event, ui ) {} );

beforeActivate( event, ui )Type: accordionbeforeactivate

Triggered directly before a panel is activated. Can be canceled to prevent the panel from activating. If the accordion is currently collapsed, ui.oldHeader and ui.oldPanel will be empty jQuery objects. If the accordion is collapsing, ui.newHeader and ui.newPanel will be empty jQuery objects.
  • event
    Type: Event
  • ui
    Type: Object
    • newHeader
      Type: jQuery
      The header that is about to be activated.
    • oldHeader
      Type: jQuery
      The header that is about to be deactivated.
    • newPanel
      Type: jQuery
      The panel that is about to be activated.
    • oldPanel
      Type: jQuery
      The panel that is about to be deactivated.
Code examples:

Initialize the accordion with the beforeActivate callback specified:

1
2
3
$( ".selector" ).accordion({
beforeActivate: function( event, ui ) {}
});

Bind an event listener to the accordionbeforeactivate event:

1
$( ".selector" ).on( "accordionbeforeactivate", function( event, ui ) {} );

create( event, ui )Type: accordioncreate

Triggered when the accordion is created. If the accordion is collapsed, ui.header and ui.panel will be empty jQuery objects.
Code examples:

Initialize the accordion with the create callback specified:

1
2
3
$( ".selector" ).accordion({
create: function( event, ui ) {}
});

Bind an event listener to the accordioncreate event:

1
$( ".selector" ).on( "accordioncreate", function( event, ui ) {} );

Example:

A simple jQuery UI Accordion

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
32
33
34
35
36
37
38
39
40
41
42
43
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>accordion demo</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
</head>
<body>
<div id="accordion">
<h3>Section 1</h3>
<div>
<p>Mauris mauris ante, blandit et, ultrices a, suscipit eget.
Integer ut neque. Vivamus nisi metus, molestie vel, gravida in,
condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros.
Nam mi. Proin viverra leo ut odio.</p>
</div>
<h3>Section 2</h3>
<div>
<p>Sed non urna. Phasellus eu ligula. Vestibulum sit amet purus.
Vivamus hendrerit, dolor aliquet laoreet, mauris turpis velit,
faucibus interdum tellus libero ac justo.</p>
</div>
<h3>Section 3</h3>
<div>
<p>Nam enim risus, molestie et, porta ac, aliquam ac, risus.
Quisque lobortis.Phasellus pellentesque purus in massa.</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
</div>
<script>
$( "#accordion" ).accordion();
</script>
</body>
</html>


반응형
Posted by 친절한 웬디양~ㅎㅎ
|
반응형

//부모창의 필드값 갖고 오기

1. 일반적인 방법

var parentValue = opener.document.getElementById("parentId").value;

 

2. jQuery를 이용한 방법

$("#parentId", opener.document).val();

 

3. find를 이용한 방법

$(opener.document).find("#parentId").val();

 

 

 

//동적으로 생성한 폼을 부모창에 붙이기

1. jQuery를 이용한 방법

$(opener.document).find("#parentId").append(html);

 

 

 

//팝업창에서 부모창 함수 호출

1-1. 일반적인 방법

opener.location.href = "javascript:부모스크립트 함수명();";

 

1-2. 일반적인 방법

window.opener.fnCall();

 

2. jQuery를 이용한 방법

$(opener.location).attr("href", "javascript:부모스크립트 함수명();");

 

 

//팝업창에서 부모창으로 값 넘기기

1-1. 일반적인 방법

window.opener.document.getElementById("parentId").value = "부모창으로 전달할 값";

 

1-2. 일반적인 방법

window.opener.폼네임.parentInputName.value = value;

 

2. jQuery를 이용한 방법

$("#parentId", opener.document).val(부모창으로 전달할 값);

 

3. find를 이용한 방법

$(opener.document).find("#parentId").val(부모창으로 전달할 값);

 

 

//부모창의 CSS 변경

1. jQuery를 이용한 방법

$("#parentId", opener.document).css("display", "none");

 

 

 

//팝업창 닫기

window.self.close();

 

 

//팝업창 자신 페이지 새로고침

document.location.reload();

 

 

//팝업창에서 부모창 새로고침(새로고침 의사 표현을 묻는 창이 뜸)

window.opener.parent.location.reload();

window.opener.document.location.reload();

 

[출처] 【jQuery】팝업창 opener|작성자 너와나

반응형
Posted by 친절한 웬디양~ㅎㅎ
|

datepicker tip

Develope/jQuery 2014. 2. 26. 16:41
반응형
반응형
Posted by 친절한 웬디양~ㅎㅎ
|