D-H,appy

관리자 글쓰기
블로그 »
블로그 »

자바스크립트로 코딩하다가

[자바스크립트] window.open 속성 사용 방법


<script type="text/javascript">

/*
window.open(url:String, name:String, properties:String)
open
함수는 반드시 3개의 매개변수가 있고, 매개변수 순서는 지켜야 함.
name
은 팝업창의 이름, 주로 프레임 문서의 Target으로 사용

name
은 사용하지 않으려면 " " 만 표시해줍니다. 반드시 표시해야 함.
*/


function win() {
window.open("http://eschyles.mireene.com/", "", "");  //
속성 지정하지 않은 기본창

}


function menu_win() {
window.open("http://eschyles.mireene.com/", "", "menubar=1");  //
메뉴바 없는 팝업
}


function full_win() {
window.open("http://eschyles.mireene.com/", "", "fullscreen"); //
풀스크린 방식
}

function channel_win() {
window.open("http://eschyles.mireene.com/", "", "channelmode"); //
채널모드

}


function status_win() { //
상태표시바 있는 팝업
window.open("http://eschyles.mireene.com/", "", "width=400, height=300, status=1");
}


function popup_win1() { //
크기 width400 height300 팝업창
window.open("http://eschyles.mireene.com/", "", "width=400, height=300");
}


function popup_win2() { //
위치 left=500, top=400 에서 열리는 팝업창
window.open("http://eschyles.mireene.com/", "", "width=400, height=300, left=500, top=400");
}


function popup_win3() { //
스크롤바 있는 팝업
window.open("http://eschyles.mireene.com/", "", "width=400, height=300,  scrollbars=1");
}


function popup_win4() { //
주소표시줄 있는 팝업
window.open("http://eschyles.mireene.com/", "", "width=400, height=300, left=100, location=1");
}
</script>


<body>
<input type="button" value="
속성 지정하지 않은 기본 창" onclick="win()">

<input type="button" value="
메뉴바 없는 팝업
" onclick="menu_win()">

<input type="button" value="
풀스크린 팝업
" onclick="full_win()">

<input type="button" value="
채널모드 팝업
" onclick="channel_win()">

<input type="button" value="
상태표시바 있는 팝업
" onclick="status_win()">

<input type="button" value="width400 height300
팝업창
" onclick="popup_win1()">

<input type="button" value="
위치 left=500, top=400 팝업창
" onclick="popup_win2()">

<input type="button" value="
스크롤바 있는 팝업
" onclick="popup_win3()">

<input type="button" value="
주소 입력 표시줄 있는 팝업
" onclick="popup_win4()">

</body>

[출처] [자바스크립트] window.open 속성 사용 방법|작성자 스시대장



--------------
window.open 함수로 파일 다운로드 URL을 링크로 열어서 바로 다운받게 할려고 했는데
인터넷 익스플로러에서는 안먹히고 창이 열리고 주소창에 링크만 써졌다

그 링크를 복사해서 다시 넣고 실행하면 다운은 되는 쓰잘데기 없는 뻘 현상이 발생...

익스플로러 보안문제로 팝업이나 그런 설정 문제가 원인인줄 알았으나...

window.open(url:String, name:String, properties:String)에서
name속성이 문제였다.

창에 이름을 넣으려고 특정 스트링을 넣었는데
그래서 타겟이 이상한 창으로 되어서 바로 실행이 안된것 같았다

name=''로 하니까 됨

2010/01/15 19:09 2010/01/15 19:09

(go to top)

블로그 »

void CngssDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
 // TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
 PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x,point.y));

 CDialog::OnLButtonDown(nFlags, point);
}

2009/12/20 14:42 2009/12/20 14:42

(go to top)

블로그 »

1. 다이얼로그 헤더에 비트맵 변수 추가

CBitmap m_bmpDlg;

2. 클래스 위자드로  함수 추가
void CngssDlg::LoadSkin()
{
      //추가한 비트맵 리소스를 비트맵 변수에 연결
      m_bmpDlg.LoadBitmap( IDB_BITMAP_BACKGROUND );
      BITMAP bmp;
      m_bmpDlg.GetBitmap( &bmp );

      //비트맵 크기대로 Dialog사이즈 변경 및 다이얼로그 위치를 중앙으로
      SetWindowPos( NULL, 0, 0, bmp.bmWidth, bmp.bmHeight, SWP_NOZORDER );
      CenterWindow();
}

3. 클래스에서 메시지 함수 OnEraseBkgnd추가

CRect rc;
GetClientRect(&rc);

CDC MemDC;
MemDC.CreateCompatibleDC(pDC);

CBitmap* pbmpOld = MemDC.SelectObject( &m_bmpDlg );
pDC->BitBlt(0, 0, rc.right, rc.bottom, &MemDC, 0, 0, SRCCOPY);

MemDC.SelectObject( pbmpOld );
ReleaseDC(pDC);
return TRUE;

4. OnInitDialog함수에서 LoadSkin()함수 호출

LoadSkin();

5. 테스트

2009/12/18 16:23 2009/12/18 16:23

(go to top)