JavaScript Basic

Basic Buttons

닫기

javascript:window.close();

최상단으로

javascript:window.scrollTo(0,0);

한 페이지 뒤로

javascript:history.back();
javascript:history.go(-1);

한 페이지 앞으로

javascript:history.forward(); javascript:history.go(1);

특정 페이지 이동

onclick="window.location.href='page.html'"

새로고침

javascript:location.reload();
javascript:history.go(0);

ex) <a href="javascript:location.reload(true)">Refresh this page</a>

클릭시 새창으로 대상 띄움

onclick="window.open('target.html','_blank');"

기타

Accessible Popup

<a href="popup_myapply.html" onclick="window.open(this.href, 'location', 'width=380, height=155, scrollbars=yes'); return false;" >

Print – On Load

<body onload="if('' != '1') window.print();">

Print – OnClick

onClick="window.print();"

Focus to Input

<input onfocus="this.className='text_focus'" onblur="this.className='text_blur'" />

Window Size

javascript:self.moveTo(screen.availWidth/2-512,0);self.resizeTo(1024,screen.availHeight);
javascript:self.moveTo(0,0);self.resizeTo(1024,768);