« Previous : 1 : 2 : 3 : 4 : Next »

html객체 위치 가져오기

 function getStyle(obj, jsprop, cssprop) {
   if (obj.currentStyle) {
     return obj.currentStyle[jsprop];

   } else if (window.getComputedStyle) {
     return document.defaultView.getComputedStyle(obj, null).getPropertyValue(cssprop);

   } else {
     return null;
   }
 }

 function changeElement() {
   var obj = document.getElementById("myAnimalImg");
   var ret = getStyle(obj, "top", "top");

   alert(ret);
 }


Posted by Junios

2010/08/05 16:30 2010/08/05 16:30
,
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/262

HTTP 환경변수

미리 정의된 변수 (Predefined variables)
PHP는 모든 스크립트에 대해 그 스크립트가 실행 될 때 여러개의 미리 정의된 변수를 제공한다. 이 변수중 서버의 종류나 버전, 기타 다른 요인으로 인해 달라지는 것도 많은데, 그런 변수는 이곳에 문서화 되지 않았다. 또한 이 변수중 다수는 PHP가 command-line으로 동작할 때는 사용할 수 없다.

이런 여러 요인이 있지만 이곳에서는 가장 일반적인 환경인 Apache 1.3.6 에서 모듈로 PHP3를 설치한 환경에서의 미리 정의된 변수를 살펴보도록 하자.

여러분이 사용하는 시스템의 모든 미리 정의된 변수를 보려면 phpinfo() 함수를 사용하자. (이 함수는 다른 여러 유용한 정보도 알려준다.)

참고: 여기나온 목록은 완전하지 않다. (완벽할 생각도 없다.) 이 목록은 단순히 여러분의 스크립트에서 어떤 종류의 미리 정의된 변수가 사용될 수 있는가의 예시일 뿐이다.


Apache variables
이 변수는 Apache 웹서버로부터 생성된 것이다. 만약 여러분이 다른 웹서버를 사용하고 있다면 이와 동일한 변수가 생성된다고 보장할 수 없다. 아마도 일부는 없어지고, 여기에 없는 변수가 새로 생길 것이다. 여기에 있는 변수중 대부분은 CGI 1.1 specification에서 나온 것이고, 그 내용대로 사용된다.

이곳에 있는 변수중 PHP가 command line으로 동작할 경우 사용될 수 있는 것은 거의 없다.



GATEWAY_INTERFACE
서버가 사용하고 있는 CGI specification의 revision. 예: 'CGI/1.1'.


SERVER_NAME
현재 스크립트가 실행되고 있는 호스트의 이름. 만약 스크립트가 가상 호스트에서 실행되고 있다면, 이 값은 가상 호스트의 값이 될 것이다.


SERVER_SOFTWARE
요구에 대한 대답의 헤더에 사용할 서버 identification 문자열


SERVER_PROTOCOL
페이지가 요구되어질 때 사용한 프로토콜의 이름과 리비젼. 예: 'HTTP/1.0';


REQUEST_METHOD
페이지가 요구될 때 사용된 method: 예: 'GET', 'HEAD', 'POST', 'PUT'.


QUERY_STRING
해당 페이지를 접근할 때 사용된 query string.


DOCUMENT_ROOT
현재 스크립트가 샐행중인 document root 디렉토리. 서버의 설정 파일에 정의되어 있다.


HTTP_ACCEPT
현재의 요구(request)에 포함된 Accept: 헤더의 내용 (존재하는 경우만)


HTTP_ACCEPT_CHARSET
현재의 요구(request)에 포함된 Accept-Charset: 헤더의 내용 (존재하는 경우만). 예: 'iso-8859-1,*,utf-8'.


HTTP_ENCODING
현재의 요구(request)에 포함된 Accept-Encoding: 헤더의 내용 (존재하는 경우만). 예: 'gzip'.


HTTP_ACCEPT_LANGUAGE
현재의 요구(request)에 포함된 Accept-Language: 헤더의 내용 (존재하는 경우만). 예: 'en'.


HTTP_CONNECTION
현재의 요구(request)에 포함된 Connection: 헤더의 내용 (존재하는 경우만). 예: 'Keep-Alive'.


HTTP_HOST
현재의 요구(request)에 포함된 Host: 헤더의 내용 (존재하는 경우만).


HTTP_REFERER
현재 페이지를 찾아온 페이지. 현재페이지로 넘어오는 링크가 있고, 이 링크를 클릭하여 현재 페이지로 넘어온 경우 이전 페이지의 주소가 설정된다. 이 값은 사용자의 브라우저에 따라 설정될 수도 있고 아닐 수도 있다.


HTTP_USER_AGENT
현재의 요구(request)에 포함된 User_Agent: 헤더의 내용 (존재하는 경우만). 현재 페이지를 화면에 표시할 브라우저 소프트웨어의 상징이 되는 문자열이다. 예:Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586) 특히, 이 값을 get_browser()함수와 함께 사용하면, 해당 페이지를 시용자의 브라우저의 능력에 맞춰서 만들어 낼 수도 있다.


REMOTE_ADDR
사용자가 현재 페이지를 보고 있는 시스템의 IP 주소


REMOTE_PORT
사용자의 시스템이 웹서버와 통신하고 있는 port 번호


SCRIPT_FILENAME
현재 실행되고 있는 스크립트의 절대 경로명


SERVER_ADMIN
웹서버 설정 파일에서 SERVER_ADMIN (Apache의 예) 지시자에 설정되어 있는 값. 만약 스크립트가 가상 호스트 상에서 실행되고 있다면 이 값은 virtual host 설정내에 설정된 값이 된다.


SERVER_PORT
웹서버가 사용하는 port 번호. 기본값으로 보통 '80'이 사용되지만, 예를들어 SSL을 사용하는 경우 여러분이 지정한 secure HTTP 포트의 값이 사용된다.


SERVER_SIGNATURE
server-generated 페이지에 추가되는 서버 버전과 가상 호스트 명. (enabled된 경우만)


PATH_TRANSLATED
모든 virtual을 real로의 전환을 마친 후, 현재 페이지의 파일시스템 기준의 경로. (document root 기준이 아니다.)


SCRIPT_NAME
현재 스크립트의 경로. 이것은 해당 페이지가 자기 자신을 가리킬 때 사용하면 유용하다.


REQUEST_URI
이 페이지를 접근하기 위해 사용한 URI. 예: '/index.html'.


환경 변수 (Environment variables)
이 변수들은 PHP 파서가 실행되고 있는 환경 변수로 부터 PHP의 전역 변수 영역으로 옮겨진 변수들이다. 많은 변수는 PHP가 실행되는 쉘에서 제공하고 있고, 그 내용은 시스템과 쉘에 따라 모두 각각 다르기 때문에 명확한 변수들의 목록을 제시하는 것은 불가능하다. 어떤 환경 변수들이 정의 되어 있는지 알아보려면 여러분의 쉘에 관한 문서를 살펴 보도록 하라.

CGI 변수를 포함한 다른 환경변수들은 PHP가 CGI로 동작하거나 모듈로 동작하건 간에 사용할 수 있다.

PHP 변수
이 변수들은 PHP 자신이 만드는 것이다. $HTTP_*_VARS 변수들은 track_vars 설정이 켜져 있는 경우에만 사용이 가능하다.

참고: PHP 4.0.3에서 track_vars는 설정 파일의 설정과 관계없이 항상 켜져 있다.

만약 register_globals 지시자가 설정되어 있으면, 이 변수들은 스크립트의 전역 영역에서 접근 가능한 변수로 만들어 진다. ($HTTP_*_VARS 배열 변수와는 별도로 생성된다.) 이 설정은 매우 조심해서 사용해야 하고, 가능하면 이 설정은 꺼 두고 $HTTP_*_VARS 변수를 사용하는 것이 안전하다. 악의적인 의도를 가진 사용자가 사용자 입력을 사용해서 원래 있는 전역 변수의 내용을 덮어 써 버릴 수 있다. 만약 register_globals설정을 끌 수 없는 상황이라면, 여러분이 해당 변수를 사용하는 각 스텝마다 그 변수가 안전한 것인지를 반드시 확인하는 절차가 있어야 한다.



argv
스크립트에 전달된 아귀먼트(argument)의 배열. 스크립트가 커맨드라인 에서 실행되었다면, 커맨드라인의 파라메터들을 C 형태로 접근할 수 있게 해 준다. 만약 GET 방식으로 호출된 경우라면, 이 배열은 쿼리 문자열의 내용을 담고 있다.


argc
스크립트로 넘어온 커맨드라인 파라메터의 개수. (커맨드라인 형태로 호출한 경우)


PHP_SELF
document root를 기준으로 한 현재 실행중인 스크립트의 파일 이름. PHP를 커맨드라인으로 샐행한 경우 이 변수는 사용할 수 없다.


HTTP_COOKIE_VARS
현재 스크립트에 HTTP 쿠키를 사용해 전달된 변수의 associative 배열


HTTP_GET_VARS
현재 스크립트에 HTTP GET 메소드를 사용해 전달된 변수의 associative 배열


HTTP_POST_VARS
현재 스크립트에 HTTP POST 메소드를 사용해 전달된 변수의 associative 배열


HTTP_POST_FILES
현재 스크립트에 HTTP POST 메소드를 사용해 업로드된 파일에 대한 정보를 가진 associative 배열 $HTTP_POST_FILES 배열의 내용에 대한 자세한 정보는 POST method uploads 부분을 살펴보자.


$HTTP_POST_FILES 변수는 4.0.0 이후에서만 유효하다.


HTTP_ENV_VARS
현재 스크립트에 현재 환경 변수에서 전달된 변수의 associative 배열


HTTP_SERVER_VARS
현재 스크립트에 HTTP 서버에서 전달된 변수의 associative 배열 이 변수들은 위에서 언급한 Apache 변수들과 유사한 내용으로 되어있다.

출처 : phpschool.com

Posted by

2008/06/02 17:06 2008/06/02 17:06
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/219

JQuery SVG Demo

JQuery SVG Demo (http://keith-wood.name/svg.html)

JQuery와 SVG 캔버스를 이용해서 그래픽을 구현해놓은 샘플이다. 별개 그려지고 속도 또한 빠르다. 다만 SVG라서 IE가 지원되지 않는다. IE가 지원되면 좋으련만.
아무튼 화려한 그래픽을 보고 싶으면 FF, Opera를 가지고 구경해보자

Posted by

2007/12/07 16:40 2007/12/07 16:40
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/201

Microsoft Lab Volta 발표

Microsoft Lab Volta 발표 (http://labs.live.com/volta/)


MS에서 Google의 GWT와 같은 툴킷을 발표 했다. 구글 맵같은 서비나, 무한 폴리곤 그리기, 유타 차병 그리기 등을 자바스크립트도 구현을 할 수 있게 됐다. 무지 느리지만 색다른 장을 볼수가 있다.
WPF나 실버라이트를 사용하면 더 좋은 효과를 만들 수도 있다. 자바스크립트로 어디까지 구현을 하려는 것일까?

Posted by

2007/12/07 16:39 2007/12/07 16:39
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/200

웹사이트에 구글 차트 API로 차트를 달아 보세요


. (http://code.google.com/apis/chart/, http://ajaxian.com/archives/use-the-google-chart-api-to-create-charts-for-your-web-applications)
구글에서 웹에서 차트를 그릴수 있는 API를 공개 했다. 새로운 컴포넌트를 구입하지 않아도 차트를 쉽게 그릴 수 있게 됐다.
차트를 그려 볼일이 있으면 한번 사용 해보자.

Posted by

2007/12/07 16:36 2007/12/07 16:36
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/199

자동 완성 기능

네이버나 구글처럼 자동 완성 기능이 필요 할때 있습니다.

그럴때 사용하라고 만들어 봤습니다.

 
사용법 : 비 prototype 사용용
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title>AJAX Auto-Complete Test</title>
 <link rel="stylesheet" media="screen" type="text/css" href="AutoComplete.css" />
<script src="./AutoComplete_prototype.js"></script>
</head>
<body>
 <input id="searchText" style="width: 200px" type="text" />
 <input id="searchButton" type="submit" value="Search"/>
 <script>
  var objAutoComplete = new AutoComplete("searchText", "objAutoComplete" );
 </script>
</body>
</html>
 
 
사용법  : prototype 사용용
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title>AJAX Auto-Complete Test</title>
 <link rel="stylesheet" media="screen" type="text/css" href="AutoComplete.css" />
 <script src="./AutoComplete.js"></script>
 <script src="./prototype.js"></script>
</head>
<body>
 <input id="searchText" style="width: 200px" type="text" />
 <input id="searchButton" type="submit" value="Search"/>
 <script>
  var objAutoComplete = new AutoComplete("searchText", "objAutoComplete" );
 </script>
</body>
</html>

[##_1L|1106018285.zip||_##]


--  DEMO






Posted by

2007/11/14 13:53 2007/11/14 13:53
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/198

Prototype 잘 아시나요? 움..

실제로 우리가 Prototype에 대하여 얼마나 잘 알고 있는지 확인하는 시간을 가져봅시다. Juiry Zaytsev씨는 어떤 넌센스한 사람들은 document.getElementById와 Ajax.Request 메서드를 함께 사용하는 것도 목격했다고 하면서 안타까움을 토로하고 Prototype 1.6의 옳은 사용법과 바르지 못한 사용법을 비교하는 포스트(How well do you know prototype)을 작성했습니다.

How well do you know prototype

//바르지 못한 방법: 
document.getElementById("foo ")
//적당한 방법: 놀랍게도 어떤 사람들은 이것에 대해 잘 모른다.
$("foo ")


//바르지 못한 방법:
var woot = document.getElementById("bar").value
var woot = $("bar").value
//적당한 방법: 폼 값의 편리하고 빠른 호출
var woot = $F("bar")


//바르지 못한 방법:
$('footer').style.height = '100px';
$('footer').style.background = '#ffc';    
//적당한 방법: 모든 브라우저가 W3C의 권고를 따르고 있지 않다.
$('footer').setStyle({
    height: '100px',
    background: '#ffc'
})


//바르지 못한 방법:
$('coolestWidgetEver').innerHTML = 'some nifty content'
//적당한 방법:
$('coolestWidgetEver').update('some nifty content')
// 아래와 같은 문법 구사가 가능해 지므로
$('coolestWidgetEver').update('some nifty content').addClassName('highlight').next().hide()


//바르지 못한 방법:
new Ajax.Request('ninja.php?weapon1=foo&weapon2=bar')
//적당한 방법: 보기 좋으며 보다 나은 파라메터 구조 사용
new Ajax.Request('ninja.php', {
    parameters: {
        weapon1: 'foo',
        weapon2: 'bar'
    }
})


//바르지 못한 방법:
new Ajax.Request('blah.php', {
    method: 'POST',
    asynchronous: true,
    contentType: 'application/x-www-form-urlencoded',
    encoding: 'UTF-8',
})
//적당한 방법: 기본옵션은 생략하라!
new Ajax.Request('blah.php')


//바르지 못한 방법:
Event.observe('myContainer', 'click', doSomeMagic)
//적당한 방법: 논쟁의 여지가 있지만 객체지향적이다!
$('myContainer').observe('click', doSomeMagic)


//바르지 못한 방법:
$$('div.hidden').each(function(el){
    el.show();
})
//적당한 방법: 슬프게도 이 사용법을 아는 사람들이 많지 않다는 사실.
$$('div.hidden').invoke('show')


//바르지 못한 방법:
$$('div.collapsed').each(function(el){
    el.observe('click', expand);
})
//적당한 방법: invoke를 이용한 이벤트 핸들링, 졸라 쉽다!
$$('div.collapsed').invoke('observe', 'click', expand)


//바르지 못한 방법:
$$('input.date').invoke('observe', 'focus', onFocus);
$$('input.date').invoke('observe', 'blur', onBlur);
//적당한 방법: $$는 오버해드가 크기 때문에 invoke를 사용하면 $$를 여러번 사용할 필요도 없다.
$$('input.date').invoke('observe', 'focus', onFocus).invoke('observe', 'blur', onBlur)


//바르지 못한 방법:
$('productTable').innerHTML =
    $('productTable').innerHTML +
    '<tr><td>' + productId + ' '
    + productName + '</td></tr><tr><td>'
    + productId + ' ' + productPrice +
    '</td></tr>'
//적당한 방법: Template 클래스는 정말 쓸만한 DOM 솔루션이다. 하지만 잘 사용되고 있지 않는 것 같다.
var rowTemplate = new Template('<tr><td>#{id} #{name}</td></tr><tr><td>#{id} #{price}</td></tr>');
$('productTable').insert(
    rowTemplate.evaluate({
        id: productId,
        name: productName,
        price: productPrice
    }))
)

사실 저 또한 지금까지 몸에 배인 코드를 습관처럼 즐겨쓰기 때문에 새로운 방법에 익숙해지길 꺼려할 때가 있습니다. 하지만 invoke메서드나 Template메서드는 활용 가치가 매우 높다는 사실을 일깨워 주네요. 부록으로 How well do you know prototype Part 2도 참고하세요.


준님 아자씨꺼에서 퍼왔다. 괜찮은게 많다. ㅎㅎ

Posted by

2007/11/13 16:28 2007/11/13 16:28
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/197

Pete LePage씨는 IE블로그를 통해서 더이상 "Click to Activate" 메시지가 나타나지 않을 것이라는 글을 작성했습니다. 이올라스(Eolas) 소송건 때문에 2006년 4월 이후 업데이트된 IE에서는 플래시 오브젝트가 사용될 경우 클릭하여 활성화해야 했습니다. 약 20개월이 흐른 지금, MS가 이올라스로부터 관련기술의 라이센스를 취득하여 더이상 이 메시지가 나타나지 않을 것이라고 합니다. 이는 곧 SWFObject와 같은 자동 활성화 스크립트를 작성할 일도 없어지게 되는 것입니다. 우선 이번 달(12월)부터 다운로드 센터를 통해 부분적 업데이트를 시작으로 윈도 비스타 SP1과 윈도XP SP3에서는 완전히 사라지할 계획이라고 밝혔습니다. 앞으로 골치아픈 치닥거리가 한가지 줄었지만, 그동안 사용해온 우회코드들를 수정해야하는 치닥거리가 생겨났습니다. 기쁨과 짜증이 교차하는 순간입니다.

Posted by

2007/11/12 11:19 2007/11/12 11:19
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/196

Prototype 1.6

버그 수정이 되었고, 낳아졌따 ㅎㅎ

Highlights

  • Ajax transport objects are now automatically wrapped in an Ajax.Response object.
  • Ajax.Response includes support for accessing JSON response bodies as JavaScript objects via the responseJSON property.
  • The class API now includes full support for inheritance and superclass method calls. (See Mislav’s tutorial for more info.)
  • Class objects now have an addMethods method for adding instance methods after creation.
  • Elements can be created easily with the new Element(…) syntax.
  • Element#insert provides a unified API to DOM element and HTML fragment insertion.
  • Element#select is an alias for getElementsBySelector and is now the preferred way to find elements by class name.
  • Element#wrap lets you easily wrap an element inside another element in place.
  • Enumerable methods on Array are now backed by native Array#forEach implementations when possible.
  • Enumerable now has aliases for equivalent JavaScript 1.6 Array methods, and support for JavaScript 1.6’s context parameter for automatic callback binding.
  • Enumerable#grep now calls the match method on its first argument, so you can use it to e.g. filter an array of DOM nodes by CSS selector.
  • Event objects are now automatically extended with instance methods, so you can write e.g. event.stop() instead of Event.stop(event).
  • Prototype’s event API now supports firing DOM-based custom events with Element#fire.
  • The new dom:loaded custom event fires when the entire document has loaded and is ready for manipulation.
  • Function#curry allows for partial application of function arguments.
  • Function#wrap facilitates simple aspect-oriented programming and provides the basis for Prototype’s superclass method call mechanism.
  • Function#delay delays invocation of the function by the given number of seconds.
  • Function#defer schedules the function to run as soon as the interpreter is idle.
  • The Hash API has changed, and you must now use Hash#get and Hash#set instead of directly accessing properties on Hash instances.
  • String#interpolate is a shortcut for instantiating a Template from the string and calling evaluate on it.
  • Object properties can now be used in template replacement strings.

Script.aculo.us 1.8

This is the last release before 2.0 comes out and features:

  • Complete rewrite of Ajax.InPlaceEditor and Ajax.InPlaceCollectionEditor
  • Full CSS inheritance in Effect.Morph
  • New core effect: Effect.Tween
  • Sound: play mp3 files for sound effects; uses native playback on IE and available plugins whereever possible
  • Duration and distance options for Effect.Shake
  • Performance improvements
  • Tons of bugfixes

내가 주로 사용하는 라입이 버전업을 정식으로 오픈했다. ㅎㅎ

머가 이리 맨날 바뀌는건지 --;;

Posted by

2007/11/08 14:04 2007/11/08 14:04
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/194

이미지 확대기, PopBox

사용하기 쉽고 이쁜 이미지 확대기... 움 만들면 되겠지만, 그러나 언제나 다 만들면 시간이 안되기 때문에.. 아무튼 괜찮은 이미지 확대기이다.
PopBox!

Posted by

2007/11/07 11:27 2007/11/07 11:27
Response
No Trackback , No Comment
RSS :
http://junios.net/tc/rss/response/193

« Previous : 1 : 2 : 3 : 4 : Next »

블로그 이미지

Junios World

- Junios

Archives

Authors

  1. Junios

Calendar

«   2010/09   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    

Site Stats

Total hits:
32815
Today:
25
Yesterday:
139