Jquery 부모창 컨트롤!!Jquery 부모창 컨트롤!!

Posted at 2012/04/12 09:21 | Posted in Dev/Jquery


$(document.opener).find($("#아이디").val());

 

예)

$(document.opener).find($("#아이디").append(html));

- 동적으로 생성한 폼을 부모창에 넣기

$(document.opener).find($("#아이디").click());

- 부모창에 있는 버튼 클릭


등등등

저작자 표시 비영리

'Dev > Jquery' 카테고리의 다른 글

Jquery 부모창 컨트롤!!  (0) 2012/04/12
jquery css 스타일 / class 변경  (0) 2012/03/21
jquery 이미지에 커서올리면 테두리 생성시키기  (0) 2012/03/21
Jquery select .change() 사용하기  (0) 2012/01/13
jQuery hide, show, toggle  (0) 2012/01/11
Jquery checkbox 컨트롤  (0) 2012/01/11

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

jquery css 스타일 / class 변경jquery css 스타일 / class 변경

Posted at 2012/03/21 16:48 | Posted in Dev/Jquery
css  변경
제거 : $("#name").css("border", "none");
추가 : $("#name").css("border", "5px"); 


class 변경
제거 : $("#name").removeClass("클래스명");
추가 : $("#name").
addClass("클래스명");  

저작자 표시 비영리

'Dev > Jquery' 카테고리의 다른 글

Jquery 부모창 컨트롤!!  (0) 2012/04/12
jquery css 스타일 / class 변경  (0) 2012/03/21
jquery 이미지에 커서올리면 테두리 생성시키기  (0) 2012/03/21
Jquery select .change() 사용하기  (0) 2012/01/13
jQuery hide, show, toggle  (0) 2012/01/11
Jquery checkbox 컨트롤  (0) 2012/01/11

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

jquery 이미지에 커서올리면 테두리 생성시키기jquery 이미지에 커서올리면 테두리 생성시키기

Posted at 2012/03/21 15:33 | Posted in Dev/Jquery

테두리 생성하는 스타일 만듬

    <style>
        .rect_img_border
        {
         position:absolute;   
         border:4px solid #000;
         filter:alpha(opacity=80);
         opacity:0.8;
         -moz-opacity:0.8;
         -khtml-opacity:0.8;
        }
    </style>

커서 올리면 작동할 스크립트 
<script>
    function rect_img_border(lid) {
        $(".rect_img" + lid).append(function (i, html) {                        
            $(this).html('<li class="rect_img_border" id="imgborder"' + lid + '"></li>' + html);
            $('li', $(this)).css({ width: "256px", height: "277px" });
        });

        $("#imgurl" + lid).val($("#imgborder" + lid).html().toLowerCase());

        var imgUrl = $("#imgurl" + lid).val();
        var aImgUrl = $("#imgurl" + lid).val().split("<img");

        if (aImgUrl.length > 1) {
            $("#imgurl" + lid).val("<img " + aImgUrl[1]);
        }

        $("#chk").val("1");          
    }
</script>


이미지 
<li id="imgborder1" class="rect_img1"><img src="/img/port/p_ex1.jpg" style="cursor:pointer;"/></li> 


희든값
 
<input type="text" id="chk" value="0" style="display:none;"/>    
 
<input type="text" id="imgurl1" value="" style="display:none; width:400px;"/>


이벤트 
<script>
    $(function () {
        $(document).on("mouseenter", "#imgborder1", function () { if ($("#chk").val() == "0") { rect_img_border("1"); } });
        $(document).on("mouseleave", "#imgborder1", function () { $(this).html($("#imgurl1").val()); $("#chk").val("0"); });
    });
</script>
 
저작자 표시 비영리

'Dev > Jquery' 카테고리의 다른 글

Jquery 부모창 컨트롤!!  (0) 2012/04/12
jquery css 스타일 / class 변경  (0) 2012/03/21
jquery 이미지에 커서올리면 테두리 생성시키기  (0) 2012/03/21
Jquery select .change() 사용하기  (0) 2012/01/13
jQuery hide, show, toggle  (0) 2012/01/11
Jquery checkbox 컨트롤  (0) 2012/01/11

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery select .change() 사용하기Jquery select .change() 사용하기

Posted at 2012/01/13 19:13 | Posted in Dev/Jquery
  • .change( handler(eventObject) )

    handler(eventObject)A function to execute each time the event is triggered.

  • version added: 1.4.3.change( [eventData], handler(eventObject) )

    eventDataA map of data that will be passed to the event handler.

    handler(eventObject)A function to execute each time the event is triggered.

  • version added: 1.0.change()


For example, consider the HTML:

<form>
  <input class="target" type="text" value="Field 1" />
  <select class="target">
    <option value="option1" selected="selected">Option 1</option>
    <option value="option2">Option 2</option>
  </select>
</form>
<div id="other">
  Trigger the handler
</div>

The event handler can be bound to the text input and the select box:

$('.target').change(function() {
  alert('Handler for .change() called.');
});



저작자 표시 비영리

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

jQuery hide, show, togglejQuery hide, show, toggle

Posted at 2012/01/11 15:34 | Posted in Dev/Jquery

 jQuery를 이용한 show 와 hide, 그리고 이 것을 하나의 버튼에 구현하는 toggle 입니다. 

<div id='theDiv'></div>
<button id='show'>Show</button>
<button id='hide'>Hide</button>
<button id='toggle'>Toggle</button>


<script type='text/javascript'>
$(function() {
     $('#show').click(function(){
     $('#theDiv').show();
});
     $('#hide').click(function(){
     $('#theDiv').hide();
});
     $('#toggle').click(function(){
     $('#theDiv').toggle();
});
});
</script>

style.display = "none"; 
style.display = "block"; 

하던것을 쉽게 사용할수 있을듯하네요 

저작자 표시 비영리

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery checkbox 컨트롤Jquery checkbox 컨트롤

Posted at 2012/01/11 03:18 | Posted in Dev/Jquery

1. 개수 구하기


$("input[name=chk1]:checkbox:checked").length


2. 체크여부 확인


$("#check_all").is(':checked')


3.  chk1 개수만큼 돌면서 실행한다

  $("input[name='item[]']:checkbox:checked").each(function(){items.push($(this).val());}); 

  var items_str = items.join(',');

  또는 var items_str = items.toString();


  또는 var items_str = $("input[name='item[]']:checkbox:checked").map(function () {return this.value;}).get();


4. disabled 하기

$("input[name=chk1]").attr('disabled', 'true');

저작자 표시 비영리

'Dev > Jquery' 카테고리의 다른 글

Jquery select .change() 사용하기  (0) 2012/01/13
jQuery hide, show, toggle  (0) 2012/01/11
Jquery checkbox 컨트롤  (0) 2012/01/11
Jquery radio 값 가져오기 및 설정  (0) 2012/01/11
Jquery select 값 가져오기 및 설정  (0) 2012/01/11
Jquery nyroModal Plugin (레이어 팝업)  (0) 2012/01/10

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery radio 값 가져오기 및 설정Jquery radio 값 가져오기 및 설정

Posted at 2012/01/11 03:16 | Posted in Dev/Jquery

if($(':radio[name="radioname"]:checked').length < 1)
{ alert('분류를 선택하세요'); it.
radioname[0].focus(); return false; } 

또는 if (!$(':radio[name="radioname"]:checked').val())
{ alert('성별을 선택하세요'); $("#gender1").select(); return false; } 

if($(':radio[name="radioname"]:checked').val() != 3) { ... }

체크해제 : $("#radioname").attr('checked', 'false')가 안되서 it.place[1].checked = false; 로 적용함


disabled : $(':radio[name="
radioname"]').attr('disabled', 'disabled');

저작자 표시 비영리

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery select 값 가져오기 및 설정Jquery select 값 가져오기 및 설정

Posted at 2012/01/11 03:12 | Posted in Dev/Jquery

select box의 내용 가져오기
$("#select_box > option:selected").val();

select box의 값 설정
 $("#select_box > option[value=지정값]").attr("selected", "true")

select disabled 
$('#
select_box ').attr('disabled', 'true');
해제 $('#
select_box ').attr('disabled', ''); // 'false'를 줬을경우 안됨

저작자 표시 비영리

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery nyroModal Plugin (레이어 팝업)Jquery nyroModal Plugin (레이어 팝업)

Posted at 2012/01/10 02:42 | Posted in Dev/Jquery
URL : http://nyromodal.nyrodev.com/

레이어 팝업 띄우는 플러그인 

URL 가서 예제 보면 쉽게 사용할수 있음~ 
저작자 표시 비영리

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery 즐겨찾기 만들기 (jqbookmark.js)Jquery 즐겨찾기 만들기 (jqbookmark.js)

Posted at 2012/01/10 02:34 | Posted in Dev/Jquery
정보 URL : http://calisza.wordpress.com/2008/11/03/javascript-jquery-bookmark-script/

 jqbookmark.js 파일을 임포트 하고

<a href="링크URL" title="즐겨찾기 이름" class="jqbookmark"><img src="/admins/images/login/btn_favor.gif" alt="" class="atbtn" style="cursor:pointer;" /></a>

이렇게 사용 
저작자 표시 비영리

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기

Jquery cookie 사용하기Jquery cookie 사용하기

Posted at 2012/01/09 11:40 | Posted in Dev/Jquery
다운로드 경로 : https://github.com/carhartl/jquery-cookie

간단 사용법

js 파일(jquery.cookie.js) 임포트 한 후

<쿠키생성>

1. 세션 쿠키(Session Cookie)

세션 쿠키는 브라우저 열려있는 동안만 유지된다

$.cookie('key' , 'value');

2. 만료일 지정한 쿠키

$.cookie('key' , 'value', { expires : 값 });

값의 단위는 일(日)단위 이다

주의할 점은 위 생성방식 모두 디폴트로 쿠키가 만들어진 페이지 경로에만 쿠키가 적용된다

모든 페이지에 쿠키를 적용하려면 아래와 같이 path : '/' 를 설정 해야 한다

$.cookie('key' , 'value', { expires : 값, path : '/' });

$.cookie('key' , 'value', { path : '/' });

<쿠키 읽기>

$.cookie('key');

위처럼 하면 저장된 값을 반환한다. 해당 key가 없다면 null 반환

<쿠키삭제>

$.cookie('key', null);

path 옵션을 주어 쿠키를 만들었다면 삭제할때 역시 같은 path 옵션을 줌 (이것 떄문에 삽질 대박함)

<쿠키 생성시 옵션 항목>

expires : 365

쿠키 만료를 일단위로 설정한다 생략하면 세션 쿠키로 만들어진다

path : '/'

쿠키가 적용되는 페이지 경로. 사이트 전체 페이지에 적용하려면 위와같이 설정

domain : 'domain.com'

쿠키가 적용될 도메인 디폴트가 쿠키가 만들어진 도메인이다

secure : true

디폴트는 false 다. true로 설정하면 쿠키전송은 https 프로토콜로만 가능

raw : true

디폴트는 false이다 false 일 경우는 쿠키는 생성되거나 읽을 떄 기본적으로 인코딩/디코딩을 한다(encodeURIComponent / decodeURIComponent 이용)

저작자 표시 비영리
  1. 완전 잘 정리해주셨네요 감사합니다!!
  2. 너무 잘 정리해주셨네요~~ 원문 링크 포함 제 블로그에 퍼갈께요 ^^*

Name __

Password __

Link (Your Website)

Comment

SECRET | 비밀글로 남기기