on
Javascript map, BOM, DOM
Javascript map, BOM, DOM
< !DOCTYPE html >
< html >
< head >
< meta charset = "UTF-8" >
< title > Practice < / title >
< script type = "text/javascript" >
/* 로케이션의 속성 */
console .log( location .origin);
console .log( location .pathname);
console .log( location .hostname);
console .log( location .host);
console .log( location .protocol);
console .log( location .port);
function xxx() { //새로고침하는 함수
location .reload();
}
function test() { //test클릭시 호출되는 함수
var t = document . getElementById ( "myForm" );
/* id가 myform에서 element를 뽑아온다 */
/* id는 1개만 존재하기에 element뒤에 s가 안붙음 */
console .log(t);
}
function yyy() { //로케이션을 통해 practice2로이동
location .href = "practice2.html" ;
}
function practice2() {
document . getElementById ( "myForm" ).action = "practice2.html" ;
/* id(myForm)를 통해 호출후 액션을 변경 */
}
function practice3() {
location .href = 'practice2.html' ;
}
< / script >
< body >
< button onclick = "test()" > test < / button >
< br >
< button onclick = "xxx()" > reload < / button >
< br >
< a href = "javascript:yyy()" > practice2.html < / a >
< br >
< button onclick = "location.href='practice2.html'" > 직접
practice2경로지정 < / button >
폼의 시작
< form id = "myForm" action = "practice3.html" >
< input type = "text" name = "userid" > < br >
< button onclick = "practice2()" > action속성 변경 < / button > < br >
< button onclick = "location.href='practice2.html'" > 직접경로지정 < / button >
< button onclick = "practice3()" > 함수로 경로지정 < / button > < br >
< button > 버튼전송 < / button >
< input type = "submit" value = "submit" >
< / form >
< / body >
from http://cocoshin.tistory.com/36 by ccl(A) rewrite - 2021-12-11 16:27:50