1. Append란?


.append(content, [content])


=> 어떤 요소에 마지막 자식 요소를 새로 추가한다.

content 추가될 HTML 문자열, DOM요소, 또는 jQuery 객체.


html


1
2
3
4
5
6
7
8
9
10
11
12
<button id="add_cert">addrow</button>
<table >
    <tr>
        <th>name</th>
        <th>price</th>
        <th></th>
    </tr>
    <tbody id="asdf">
        <tr><td>example</td><td>123,456</td></tr>
    </tbody>
    
</table>


script


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script>
var cnt2 = 0;
$("#add_cert").click(function(){
    var cnt = $(".Rowtr").length;
    if(cnt<=30){
        var addrow = '<tr class="Rowtr" id="Rowtr_'+cnt2+'"><td><input type="text" id="name_"'+cnt2+' value="'+cnt2+'"/></td>
    <td><input type="text" id="price_"'+cnt2+'/></td><td><a onclick="removeRow('+cnt2+')">-</a></td></tr>';
 
        $("#asdf").append(addrow);
        cnt++;
        cnt2++;
    }
});
function removeRow(cnt){
    $("#Rowtr_"+cnt).remove();
}
</script>


행은 30이 최대, 추가 삭제 가능



'Javascript > JQuery' 카테고리의 다른 글

[JQuery] JQuery를 이용한 CSS 사용  (0) 2017.07.27
fopen

resource fopen ( string $filename , string $mode [, bool $use_include_path = false [, resource $context ]] )

$filename

파일을 로드할 파일명 또는 파일이있는 주소 이다.


$mode


어떠한 모드로 파일을 열 것인지 설정하는 인자.

인자

모드 

포인터 위치 

파일이 존재 유무 

읽기 전용 

파일의 시작 

파일 내용 보존 

r+ 

읽고 쓰기 

파일의 시작 

파일 내용 보존 

쓰기 전용 

파일의 시작 

파일 내용 삭제, 없으면 새로 생성 

 w+

읽고 쓰기 

파일의 시작 

파일 내용 삭제, 없으면 새로 생성 

쓰기 전용 

파일의 끝 

파일 내용 보존, 없으면 새로 생성 

a+ 

읽고 쓰기 

파일의 끝 

파일 내용 보존, 없으면 새로 생성 

쓰기 전용 

새로운 파일 생성 

파일이 존재하면 flase 리턴  

x+ 

읽고 쓰기 

새로운 파일 생성 

파일이 존재하면 flase 리턴 


파일 읽고 쓰기 예제


$m ='수정할 text';

$dir ='파일 주소'

$file_handle = fopen($dir, "w+") or die("can't open file");

fputs($file_handle, $m);

fclose($file_handle);



<a href="image/test.png" download>이미지 다운로드</a>


href 에 원하는 주소를 넣으면 된다.


download 속성이 설정되어 있으면, 링크가 가르키는 파일을 다운로드 한다.


iphone 과 사파리에서는 새창이 열린다 ㅠ

+ Recent posts