1 i f 2 <--- 해석가능하시죠 ?

Posted
Filed under dog발;/javascript
$(document).ready(function(){
    // This button will increment the value
    $('.qtyplus').click(function(e){
        // Stop acting like a button
        e.preventDefault();
        // Get the field name
        fieldName = $(this).attr('field');
        // Get its current value
        var currentVal = parseInt($('input[name='+fieldName+']').val());
        // If is not undefined
        if (!isNaN(currentVal)) {
            // Increment
            $('input[name='+fieldName+']').val(currentVal + 1);
        } else {
            // Otherwise put a 0 there
            $('input[name='+fieldName+']').val(0);
        }
    });
    // This button will decrement the value till 0
    $(".qtyminus").click(function(e) {
        // Stop acting like a button
        e.preventDefault();
        // Get the field name
        fieldName = $(this).attr('field');
        // Get its current value
        var currentVal = parseInt($('input[name='+fieldName+']').val());
        // If it isn't undefined or its greater than 0
        if (!isNaN(currentVal) && currentVal > 0) {
            // Decrement one
            $('input[name='+fieldName+']').val(currentVal - 1);
        } else {
            // Otherwise put a 0 there
            $('input[name='+fieldName+']').val(0);
        }
    });
});
출처 : http://ememomo.tistory.com/159
2016/11/17 19:14 2016/11/17 19:14
Posted
Filed under dog발;/javascript
var oImg = new Image();

jQuery(oImg).load(function(){
     var nW = oImg.width;
     var nH = oImg.height;
     alert(nW + "x" + nH);
});

oImg.src = "이미지url";
2016/07/05 15:32 2016/07/05 15:32
Posted
Filed under dog발;/javascript
$(function(){
     $.extend($.fn.disableTextSelect = function(){
          return this.each(function(){
               if($.browser.mozilla){     //Firefox
                    $(this).css('MozUserSelect','none');
               }else if($.browser.msie){     //IE
                    $(this).bind('selectstart',function(){ return false; });
               }else{     //Opera, etc.
                    $(this).mousedown(function(){ return false; });
               }
          });
     });     //No text selection on elements with a class of 'noSelect'
    
     $('.noSelect').disableTextSelect();
});
2016/07/05 15:30 2016/07/05 15:30
Posted
Filed under dog발;/javascript
// textarea id, 제한 글자 수, 입력 결과 메세지 저장 ID
function limitCharacters(textid, limit, limitid){
	// 입력 값 저장
	var text = $('#'+textid).val();
	// 입력값 길이 저장
	var textlength = text.length;
	if(textlength < limit){
		$('#' + limitid).html('글내용을 '+limit+'자 이상 쓸수 없습니다!');
		
		// 제한 글자 길이만큼 값 재 저장
		$('#'+textid).val(text.substr(0,limit));
		return false;
	}else{
		$('#' + limitid).html('쓸수 있는 글자가 '+ (limit - textlength) +' 자 남았습니다.');
		return true;
	}
}

$(function(){
	$('#contents').keyup(function(){
		limitCharacters('contents', 20, 'charlimitid');
	})
});
출처 : mimul.com
2011/02/10 18:12 2011/02/10 18:12
Posted
Filed under dog발;/javascript


0000
1111
2222
-_-;;; 후아;;; selector 다시 공부하자 -_-;;; 한 30분 헤멨다 ㅠㅠ 흑흑;;;
2011/02/10 15:24 2011/02/10 15:24