웹 효과 추가 삭제 버튼 코드와 텍스트 입력된 상자
<! doctype HTML 공개 "-//W3C//DTD XHTML 1.0 전환 / / 엉" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1 transitional.dtd ">
< html xmlns = "http://www.jzread.com/1999/xhtml" >
< 헤드 >
< 메타 http-equiv = "content-type" 내용 = "text/html; 문자셋 = utf-8 "/ >
삭제 버튼 코드 < 제목 > 웹 효과 추가 텍스트 입력된 상자 < / 타이틀 >
</헤드 >
< 몸 >
< div id = "D" >
< 입력 유형 = "텍스트" / >
< / div >
< 입력 유형 = "버튼" id = "B" 값 = "추가" / >
</바디 >
< 스크립트 언어 = "자바 스크립트" >
document.getElementById ("B"). Onclick 함수 () 없음 =
document.getElementById ("D"). innerhtml + = ' < br >< 입력 유형 = ' 텍스트 ' / > ';
}
</스크립트 >
< / html >
방법 2 삭제 버튼
<! doctype HTML 공개 "-//W3C//DTD XHTML 1.0 전환 / / 엉" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1 transitional.dtd ""
< html xmlns = "http://www.jzread.com/1999/xhtml" < 머리 >
< 메타 http-equiv = "content-type" 내용 = "text/html; 문자셋 = utf-8 "/ & gt
< 제목 > 제목 문서 < / 제목 & gt
< / 헤드 > < 몸 >
< div id =" D ">
< 입력 유형 = "텍스트" 이름 = "Text_0" / >
< / div >
< 입력 유형 = "버튼" id = "B" 값 = "추가" / >
& Lt; / 바디 & gt
< 스크립트 언어 = "자바 스크립트"
나 = 1.
document.getElementById ("B"). Onclick 함수 () = {
document.getElementById ("D"). innerhtml + = ' < div id 'div_' + i + = ' ">< 입력된 이름 '텍스트' 이름 = 'text_' = + i + ' "유형 =" 텍스트 "/ >< 입력 유형 =" 버튼 "값 =" 삭제 "onclick =" 델 ('+ i +') "/ >< / div >";
i = i + 1;
}
함수 델 (o) {
document.getelementbyid ("D"). RemoveChild (document.getElementById ("Div_" + o));
}
< / 스크립트 >
< / html & gt