'window'에 해당되는 글 4건

  1. 2009/07/16 2009년 07월 16일 - sunyruru 미투데이 일기장
  2. 2007/11/03 Javascript window.showModalDialog()
  3. 2007/09/18 Window size and scrolling
  4. 2007/07/08 상태표시줄에 날자 시간 출력 자바스크립트
2009/07/16 11:37

2009년 07월 16일 - sunyruru 미투데이 일기장

  • OCS의 DMessengerEvents::OnContactStatusChange (http://msdn.microsoft.com/en-us/library/bb758796.aspx) . Scriptable 이라고 써있으니 스크립트에서 처리가능해야 하는데 왜 안되냐..ㅡㅡ(me2DC Microsoft,OCS,Communicator,API,UC,OnContactStatusChange,DMessengerEvents)2009-07-08 16:06:25
  • 자바스크립트 유용한 함수들을 잘 정리해둔 사이트를 찾았당… 유후~ 나중에도 쓸만한 내용이 많겠군.. 훗~(me2DC 자바스크립트,javascript,함수,사이트,webtoolkit)2009-07-14 19:19:55
  • 브라우져의 주소 부분에 javascript:var w=window.document;var p=w.plugins;for(var i in w)w.writeln(i+“=”+eval('w.'+i)+“<br/>”); 이렇게 실행하면 document개체의 값을 볼 수 있네요.(me2DC javascript,자바스크립트,window,document,개체,덤프,dump)2009-07-15 10:12:29
  • 아오.. C++ ATL COM 개체에서 받은 이벤트를 어떻게 JavaScript로 콜백해줘야 하는거냐 ㅠㅠ어렵다 제기랄…(me2DC C++,ATL,COM,ActiveX,Javascript,자바스크립트,CallBack,콜백,이벤트,Event,Internet Explorer)2009-07-15 14:47:00
  • 우리 진상.. 얼마나 피곤했으면 신입이 한시간을 라커룸에서 업무시간에 잤을까 -_ -;; 그래도 조심해야지 신입인데.. 조심좀 해~(me2DC 진상,신입,미쳤어,잠)2009-07-15 16:48:19
  • Silverlight 2 Unit Test를 .net계의 멋진 행님 스캇 구슬이 님이 만드셨나부다. Visual Studio랑 연계도 되고.. Silverlight 2.0 용으로 브라우져에서 GUI 환경으로 유닛 테스트가 되니 꽤 좋은것 같다…(me2DC Silverlight,스캇구스리,Visual studio,유닛테스트,Unit Test)2009-07-15 20:08:39

이 글은 sunyruru님의 2009년 7월 8일에서 2009년 7월 15일까지의 미투데이 내용입니다.

크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/476 관련글 쓰기

2007/11/03 18:56

Javascript window.showModalDialog()

JavaScript로 Modal Dialog를 띄우는 경우 옵션으로 주어야 하는 값들이 보통 window.open과 달라 고민되는 경우가 많다.
주로 아래와 비슷하게 사용을 많이 하고,

"status:no;dialogWidth:765px;dialogHeight:"+height+"px;help:no;scroll:no;edge:sunken;resizable=yes"

상태바가 보일지 여부, 도움말 버튼이 보일지 여부 사이즈나 테두리 사이즈 조절이 가능할지 여부등의 옵션이 존재한다.

페이지와 종속적인 모달 다이얼로그를 실행하고 싶을땐 한번쯤 위 옵션을 이용해서 테스트 해보도록 하자~

크리에이티브 커먼즈 라이선스
Creative Commons License

'Web > JavaScript' 카테고리의 다른 글

JavaScript Caps Lock  (1) 2007/11/15
Javascript - 간단한 DownLoad 스크립트  (0) 2007/11/05
Javascript window.showModalDialog()  (0) 2007/11/03
Window size and scrolling  (0) 2007/09/18
HTML WYSIWYG Editor를 만들기 위한 기본적인 사용법  (0) 2007/08/23
HTTP Cookie Javascript  (0) 2007/08/23
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/182 관련글 쓰기

2007/09/18 20:49

Window size and scrolling

참조주소 : http://www.howtocreate.co.uk/tutorials/javascript/browserwindow

윈도우창의 사이즈를 정확히 알기위해 브라우저마다의 지원여부와 어떤 속성을 이용해야 하는지 정확히 알아야 한다.

이를 위해 다음을 참고하자.



Window size and scrolling

Finding the size of the browser window

  • Clue browser can only work out window width.
  • Tkhtml Hv3 has the values reversed, but in an undetectable way, so it cannot work with this script.

There are some constants available that give the document area of the window that is available for writing to. These will not be available until after the document has loaded and the method used for referencing them is browser specific. The available constants are:

window.innerHeight/Width
Provided by most browsers, but importantly, not Internet Explorer.
document.body.clientHeight/Width
Provided by many browsers, including Internet Explorer.
document.documentElement.­clientHeight/Width
Provided by most DOM browsers, including Internet Explorer.

This is a little messy because the clientHeight/Width properties can mean different things in different browsers, and even different things in the same browser, depending on whether the document type declaration triggers the browser's strict mode or quirks mode. In some cases, they refer to the dimensions of the window, and sometimes they refer to the dimensions of the contents of the document. The table below shows what the properties mean in different browsers, and different modes:

Properties and what they relate to
Browser window.
innerHeight
document.
body.
clientHeight
document.
documentElement.
clientHeight
Opera 9.5+ strict window document window
Opera 9.5+ quirks window window document
Opera 7-9.2 window window document
Opera 6 window window N/A
Mozilla strict window document window
Mozilla quirks window window document
KHTML window document document
Safari window document document
iCab 3 window document document
iCab 2 window window N/A
IE 6+ strict N/A document window
IE 5-7 quirks N/A window 0
IE 4 N/A window N/A
ICEbrowser window window document
Tkhtml Hv3 N/A window document
Netscape 4 window N/A N/A

As you can see, the browsers seem to have settled on at least one reliable property; innerHeight. Internet Explorer is the only one that cannot make up its mind. Its influence may mean that other browsers change their clientHeight behaviour later. For now, almost all browsers provide window.innerHeight/Width so that can be used. Internet Explorer has chosen to swap the values around when it is in strict mode. Fortunately, it gives 0 in quirks mode. This means that if we see a value on the documentElement's properties, and the browser does not provide the properties on the window object, we can assume it is Internet Explorer in strict mode.

The most accurate method I could come up with uses the following algorithm, although it may have problems with future browsers, a situation which I am definitely not happy with:

  1. If window.innerHeight/Width is provided, that is fully trustworthy, use that (Hooray!).
  2. Else if document.documentElement.clientHeight/Width is provided and either one is greater than 0, use that.
  3. Else use document.body.clientHeight/Width.

This algorithm will fail with IE 6+ in 'standards compliant mode' if the window is shrunk to 0px by 0px. This is only possible when the user actively shrinks the window to hide the page within it. Even then, it will just give the height of the document instead, so it should not be a problem. The following code performs the algorithm as described.

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}






Test it here: get the inner dimensions of this window.




Note that browsers may take the width either inside or outside the scrollbar (if there is one). I do not cover any way to work with these differences.

Finding how far the window has been scrolled

  • OmniWeb 4.2-, NetFront 3.3- and Clue browser do not provide any way to do this.
  • Safari and OmniWeb 4.5+ have bugs that do not affect this script - see below.

When trying to produce document effects like falling snow, or more serious things like menus that remain in the same place relative to the browser window when the user scrolls, it is essential to be able to obtain the scrolling offsets in both the horizontal and vertical direction.

There are also three ways to find this out, but it is easier than finding the size of the window. Most browsers provide window.pageXOffset/pageYOffset. These are completely reliable. Once again, Internet Explorer is the odd one out, as it does not provide these properties. Internet Explorer and some other browsers will provide document.body.scrollLeft/Top. In strict mode, IE 6 and a few other browsers, provide document.documentElement.scrollLeft/Top.

If the scrollLeft/Top properties are provided on either the document.body or document.documentElement, they are reliable in everything except Safari and OmniWeb 4.5+, which return -8 if the scrolling is 0, but get all other scrolling offsets correct. However, as they correctly provide window.pageXOffset/pageYOffset, this script will not have any problems.

The following script will obtain the scrolling offsets.

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

Test it here: get the scrolling offsets.

크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/168 관련글 쓰기

2007/07/08 23:31

상태표시줄에 날자 시간 출력 자바스크립트

1초마다 현재 날자 시간을 구하는 함수를 호출하도록 하는 setTimeout() 함수가 중요하게 사용된다.

이 예제를 해보면 많이 주기적으로 실행되는 스크립트에 도움이 되지 않을까 생각한다 ^ ^


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>상태바의 날자표시</title>
   
    <script type="text/javascript">
    <!--//
    var id;
   
    function getNowDate()
    {
        var d = new Date();
        return "오늘은 "
            + d.getFullYear() + "년 "
            + d.getMonth() + "월 "
            + d.getDate() + "일 "
            + d.getDay() + "요일 "
            + d.getHours() + "시 "
            + d.getMinutes() + "분 "
            + d.getSeconds() + "초";
    }
   
    function printToStatus()
    {
        window.status = getNowDate();
        id = setTimeout('printToStatus()', 1000);
    }
   
    function printStop()
    {
        clearTimeout(id);
    }
    //-->
    </script>
</head>
<body onload="printToStatus()">

    <h1>상태 표시줄에 시간 가는 예제</h1>
   
    <input id="Button1" type="button" value="시계작동" onclick="printToStatus()" />
    <input id="Button2" type="button" value="시계멈춤" onclick="printStop()" />
   
</body>
</html>

크리에이티브 커먼즈 라이선스
Creative Commons License
올블로그추천버튼 블코추천버튼 블로그뉴스추천버튼 믹시추천버튼 한RSS추가버튼 구글리더기추천버튼


이 포스팅이 도움이 되었다면 구글에서 관련 정보를 찾아 보세요 ^^


Trackback 0 Comment 0

Trackback : http://i-ruru.com/trackback/93 관련글 쓰기