--------------------------------------------■ 제이쿼리-----------------------------------------------------------------------
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
--------------------------------------------■ 소스코드 정리-------------------------------------------------------------------------
http : // tools.arantius.com/tabifier
--------------------------------------------■ 캐릭터셋---------------------------------------------------------------------
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
--------------------------------------------■ idx 찾기---------------------------------------------------------------------
var $item = $('.item').on('click', function() {
var idx = $item.index(this);
console.log(idx);
});
------------------------------------------■ 객체내용보기------------------------------------------------------------------------------------------------
var txt = "";
var obj = this;
for (var x in obj) {
txt += [
x, obj[x]
] + "<br><br>";
}
$("#rs").append(txt);
-----------------------------------------■ 폼값 가져오기-------------------------------------------------
$("form[name='frm1']").serialize();
-------------------------■ 아이프레임 리사이즈1-------------------------
<iframe id = "iframe2" src = "iframe_list.php?m_idx=2&page=1" marginWidth = 0 marginHeight = 0 frameBorder = 0 width = "100%" height = "100%" scrolling = no onload = "iFrameInit('iframe2');"></iframe>
<script>
var iframe_id = '';
function iFrameInit(id) {
iframe_id = id;
var html = $("#" + id)
.contents()
.find('body')[0]
.innerHTML;
$("#vira").html(html);
$("#vira").hide();
setTimeout("setIframeHeight()", 500);
}
function setIframeHeight() {
$("#" + iframe_id).height($("#vira").height() + 70);
}
</script>
-----------------------------■ 아이프레임 리사이즈2-----------------------------------------------------------
<div id="vira" style="z-index:98;top:0px;left:0px;position:absolute;">
<div>
<!-- 아이프레임 리사이즈 -->
<iframe id="iframe" src="<?=$_SERVER[">http://<?=$_SERVER['HTTP_HOST']?>/gnu/bbs/board.php?bo_table=notice" marginWidth=0 marginHeight=0 frameBorder=0 width="100%" height="100%" scrolling=no onload="iFrameInit('iframe');"></iframe>
</div>
</div>
<script>
var iframe_id = '';
function iFrameInit(id) {
iframe_id = id;
var html = $("#"+id).contents().find('body')[0].innerHTML;
var h = $("#"+id).contents().find('body')[0].scrollHeight;
$("#"+iframe_id).height(h+70);
}
</script>
-------------------------------------■ 체크박스 전부체크-------------------------------------------------------
function allCheck(name) {
$.each($("input[name='"+name+"']"), function(i) {
if(this.checked) {
this.checked = false;
} else {
this.checked = true;
}
});
}
-------------------------------------■ jquery ajax-------------------------------------------------------
$.ajax({
type: "POST",
url: "" ,
dataType: "text",
data: "",
success: function(msg) {
alert(msg);
},
error: function(msg) {
alert(msg.responseText);
}
});
-----------------------------------■ 앱솔루트 레이어----------------------------------------------------------
<div style='width:100px;height:100px;z-index:98;top:200px;left:0px;position:absolute;background:#FFFFFF;border:1px solid;'>aaa</div>
-----------------------------------■ 테이블 border 겹치지 않게----------------------------------------
style=" border-collapse:collapse;width:100%;"
------------------------------------■ 팝업 세팅------------------------------------------------------
■ 팝업 세팅
absolute 속성 left:50%; top:50%
margin-left:- 팝업넓이 반값
margin-top:- 팝업높이 반값
-----------------------------------■ 글자 블록 넘어갈때-----------------------------------------------------------
table -> style="table-layout:fixed;"
td-> style="word-break:break-all;" 글자 블록 넘어갈때
-----------------------------------■ 글자 블록 안넘기기----------------------------------------------------
<style>
.strcut{
text - overflow : ellipsis;
white - space : nowrap;
overflow : hidden;
}
</style>
-------------------------------■ 전체메뉴 슬라이드---------------------------------------------------------
//전체메뉴 슬라이드
$("#gnb>ul").hover(function(){
$("#drop_down").css("height", drop_height);
$("#drop_down").stop().slideDown(200);
},function() {
$("#drop_down").css("height", drop_height);
$("#drop_down").stop().slideUp(200);
});
$("#drop_down").hover(function(){
$("#drop_down").css("height", drop_height);
$("#drop_down").stop().slideDown(200);
},function(){
$("#drop_down").css("height", drop_height);
$("#drop_down").stop().slideUp(200);
});
$("dd").hover(function(){
$(this).css("background", "red");
$(this.children[0]).css("color", "#ffffff");
$(this.children[0]).css("font-weight", "bold");
},function() {
$(this).css("background", "");
$(this.children[0]).css("color", "");
});
------------------------------■ 브라우져 버젼 알아내기--------------------------------------------------------------
//브라우져 버전 알아내기
var agent = navigator.userAgent.toLowerCase();
if((navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1)) {
$("#bb").html("인터넷 익스플로러 브라우저 입니다. 11");
alert("인터넷 익스플로러 브라우저 입니다. 11");
} else if(agent.indexOf("msie") != -1) {
$("#bb").html("인터넷 익스플로러 브라우저 입니다. 10 이하");
alert("인터넷 익스플로러 브라우저 입니다. 11");
} else {
alert("인터넷 익스플로러 브라우저가 아닙니다.");
}
------------------------------------------------------------------------------------------------------