SMALL

테이블로 디자인된 화면에 동적으로 내용이 변경되는 경우

텍스트의 크기에 따라 테이블이 변경되어 디자인이 깨질 경우가 있다.

다음과 같이 td 태그에  <td width=50 style="word-break:break-all"> 스타일을 지정하여 위와 같은 문제를 해결 할 수 있다.

 

1. html의 경우

- 사이즈를 지정하고 스타일을 정해준다.

// 방법 1 

<table border=1 width=100>
 <tr><td style="word-break:break-all">dddd</td><td>eeee</td></tr>
 <tr><td width=50 style="word-break:break-all" >aaaaaaaaaaaaaaaaaaaddddddddddddddddddddddddddddddddda</td><td width=50>bbbb</td></tr>
 <tr><td>dddd</td><td>eeee</td></tr>
 <tr><td>gggg</td><td>hhhh</td></tr>
</table>

 

 

 //방법2

<table  width="1200" cellpadding="0" cellspacing="1" style="word-wrap:break-word;word-break:break-all;">

 

 

2. javascript 로 동적으로  테이블을 생성할 경우

- 동적으로 테이블 로우를 추가할 경우는 다음과 같이 해준다.

- 사이즈를 지정하고 스타일을 정해준다.

        var newCell_2 = newRow.insertCell(2);
        newCell_2.width = 350;   // td size 지정
        newCell_2.style.wordBreak  = "break-all";

 

 

3. table  자체를 고정할 경우

- 이와 같이 할경우 텍스트 내용이 많을 경우 잘려서 보여지게 된다. 스크롤도 안됨.

<table border=1 width=100 style="table-layout: fixed" >

 

출처:http://blog.daum.net/jooneey22/7006643

LIST
블로그 이미지

SeoHW

,
SMALL

table 리스트 선택시 선택 tr배경 변경,  tr.after 추가

 

function 부분

var r ;

function test(id,ran)

{

   // id 는 (this) 값입니다 ran은 임의숫자를 넣어주었습니다

    $(".testColor").css("background","");

    $(".testColor").removeClass("testColor");

 

    var tr.$(id).closest("tr");

    var ch = tr.chilren();

     var trt = true;

       if(r != ran || r == undefined)

       {

           $("tr[name='test']").remove();

          r= ran;

          tr.after("<tr name='test' class='test'> <td> test1</td> <td> test2 </td> </tr>" );

        }

       var lgt =  $("tr[name='test']").length;

      if(r == ran && lgt == 0)

       {

             //추가된게 없으면 추가

              tr.after("<tr name='test' class='test'> <td> test1</td> <td> test2 </td> </tr>" );

       }

       else if(r == ran && lgt == 1 && trt )

       {

           //같은 목록을 클릭시 추가했던 tr을 다시 닫기

           $("tr[name='test']").remove();

       }

}

 

사용시-------

<input type="button" onclick="test(this,"123453")" />

LIST
블로그 이미지

SeoHW

,
SMALL

먼저 부모창에 function test(){}이라는 함수가 있다고 가정한다.


1)팝업창일경우

opener.test();

2)iframe일경우 

parent.test(); 

와 같이 호출하면 된다. (무지쉽지?) 

3) 부모창에서 iframe내 함수접근

   var ifr = document.getElementById('iframeID');

    ifr.contentWindow.function_name();

부모창에서 'iframeID'이라는 iFrame에 지정된 페이지의 function_name()함수에 접근하는 방법이다.


4) <a href='www.url.com' target='_parent'>link</a>으로 지정해도 됨. 물론 자바스크립트를 제어하는 것은 아니라서

     parent.location.href='www.url.com';과 동일한 효과만 볼수 있



출처: http://gonnie.tistory.com/entry/자바스크립트자식창에서-부마창-함수제어 [★☆괴수대백과사전☆★]

LIST
블로그 이미지

SeoHW

,
SMALL

AmCharts.makeChart("chartdiv", { // ... legend: { valueText: "", // ... }, // ... });

위와 같이 valueText : ""  해주시면 됩니다


LIST
블로그 이미지

SeoHW

,
SMALL

자동완성 기능이란 사용자가 이전에 입력했던 파라미터를 브라우저가 기억해 두었다가 비슷한 파라미터를 입력할 때 다시 보여주는 사용자 편의를 돕는 기능입니다. 하지만 가능 input 태그를 사용할 때 이 자동완성 기능 때문에 디자인이나 레이아웃을 방해할 때가 있어 꺼두고 싶을때도 있습니다.

autocomplete=”off”

이 자동완성 기능을 해제하는 방법은 아주 간단합니다.

<input type="text" autocomplete="off" />

input 태그의 속성에 autocomplete 를 off 로 설정 해주는 것입니다.

다른 방법도 있습니다. input 태그가 포함되어 있는 form 태그에서 비활성화 시키면 됩니다.

출처:http://triki.net/wiki/126

<form autocomplete="off">
  <input type="text" />
</form>

두가지 경우 모두 동일한 효과를 냅니다.

더욱 자세한 내용은 w3school.com – HTML input autocomplete Attribute 페이지를 참고하세요.

끝.

LIST
블로그 이미지

SeoHW

,
SMALL

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>


<script type="text/javascript">

  function maxLengthCheck(object){

    if (object.value.length > object.maxLength){

      object.value = object.value.slice(0, object.maxLength);

    }    

  }

  

</script>


<input type="number" maxlength="4" oninput="maxLengthCheck(this)"/>

출처 : http://milkye.tistory.com/265

LIST
블로그 이미지

SeoHW

,
SMALL

$(document).ready(function(){ $('#Btn').click(function(var result = confirm('Are you sure you want to do this?'); if(result) { //yes location.replace('index.php'); } else { //no } }); });

출처: http://88240.tistory.com/173 [shaking blog]

LIST
블로그 이미지

SeoHW

,
SMALL

checkbox 모두 체크하기 , 모두 해제하기(모두 체크하기 / 모두해제)


예제)

$("#allCk").click(function(){

//all 체크할 체크박스값 가져오기

 var ck = $("#allCk").prop("checked");

//true 이면 모두 체크

if(ck)

{

${"input[name=ckbox]").prop("checked",true);

}

//false 모두 해제

else

{

${"input[name=ckbox]").prop("checked",false);

}


});



감사합니다

LIST
블로그 이미지

SeoHW

,
SMALL

Jquery removeClass 단일,여러개 클래스 삭제


한개

$("셀렉터").removeClass("class1");

여러개

$("셀렉터").removeClass("class1 class2");


이렇게 하시면 됩니다 감사합니다

LIST
블로그 이미지

SeoHW

,
SMALL

DOM트리를 기준으로 부모 및 자식 객체를 호출하여 선택자를 활용할 수 있다.



- 부 모  : 상위 객체

$(this).parent()


- 자 식 : 하위 객체

$(this).children()


단순히 상하위 객체를 선택 할 뿐만 아니라


$(this).children("img")


처럼 태그를 세부적으로 선택 할 수도 있고,


$(this).parent().children("ul")


처럼 응용하는 등 다양한 방법이 존재한다 !!



맘대로 선택자를 주물러보자~



출처: http://sharphail.tistory.com/42 [샤해의 포스트잇]

LIST
블로그 이미지

SeoHW

,