'자바스크립트'에 해당되는 글 21건

  1. 2009/10/10 홈피에 자바스크립트로 만든 색상선택기(ColorPicker) 붙여보기. (6)
  2. 2009/07/05 시계 가젯을 만들어 보고 구글과 블로그에 띄워보자!
  3. 2009/06/26 야후 세계 지도 활용하기, 야후 거기 지도 오픈 API 매시업 (1)
  4. 2009/06/25 다음 지도를 내 것으로 만들기, 다음 지도 API 매쉬업 (2)
  5. 2009/06/24 나만의 네이버 지도 만들기, 지도 API 매쉬업(Mashup) (4)
  6. 2009/06/21 자바스크립트로 지도 만들기, 구글 지도 API 매시업(Mashup) (7)
  7. 2009/06/07 jQuery 로 텍스트 입력 박스(TextArea)에 크기 조절 막대 추가하기. (1)
  8. 2009/03/22 jQuery 애니메이트로 만들어보는 이미지 슬라이더와 전광판 (1)
  9. 2009/03/09 jQuery를 활용한 홈페이지 개발의 기본인 입력폼 제작 (6)
  10. 2009/01/27 jQuery UI로 달력과 날짜입력기(DatePicker)를 붙여보기.
  11. 2009/01/04 동적 HTML 객체 모델 요소의 위치와 면적 계산
  12. 2009/01/04 자바스크립트, 객체의 속성과 메소드와 이벤트 핸들러
  13. 2009/01/03 자바스크립트, 모서리가 둥근 테이블 만들기.
  14. 2008/10/15 자바스크립트 복수 게시물 더보기/접기(more/less) 소스 (5)
  15. 2008/09/30 자바스크립트로 아날로그 시계 만들기 (1)
  16. 2008/03/26 자바스크립트 createElement, insertBefore, replaceChild, appendChild (1)
  17. 2008/01/06 움직이는 막대그래프 자바스크립트 소스 (1)
  18. 2007/12/28 자바스크립트로 구성된 이미지 슬라이더입니다. (8)
  19. 2007/06/16 최근 1개월동안 블로그 인기 페이지 BEST 30 & 웹로그분석에 관하여...
  20. 2007/04/20 초보자를 위한 자바스크립트 이미지 슬라이더 소스코드 (1)
  21. 2007/04/01 스크랩 금지된 네이버 블로그와 카페글을 스크랩하고 싶다면... (5)
홈페이지 개발에서 색상 선택기를 만들어 붙여야 할 일이 드물기는 하지만 언제가는 필요할 때가 있으므로 jQuery 플러그인을 가져다가 입맛에 맞는 ColorPicker 를 만들어봅시다. 검색해본 여러가지 ColorPicker 플러그인 중에 이 것(http://www.eyecon.ro/colorpicker/)이 쓸만해 보여서 약간 불편한 부분과 IE6에서 화면이 깨지는 부분을 수정한 후 예제를 만들어 봤습니다. 아래는 색상 선택기 예제 실행 화면이고 하단에는 예제 소스 코드입니다.

[jQuery 색상 선택기 (ColorPicker) 예제 실행 화면]
http://www.hompydesign.com/javascript/colorpicker/
사용자 삽입 이미지

[jQuery 색상 선택기 (ColorPicker) 예제 소스 코드]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Color Picker</TITLE>
<link rel="stylesheet" href="./colorpicker.css" type="text/css" />
<link rel="stylesheet" href="./index.css" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="./colorpicker.js"></script>
<script>
$(document).ready(function(){
    $('#colorpicker_0,#colorpicker_1,#colorpicker_2,#colorpicker_3,#colorpicker_4').ColorPicker({
        onSubmit: function(hsb, hex, rgb, el) {
            check_colorpicker(el, hex);
        },
        onBeforeShow: function () {
            $(this).ColorPickerSetColor(this.value);
        },
        onChange: function (hsb, hex, rgb, el) {
        }
    })
    .bind('keyup', function(){
        $(this).ColorPickerSetColor(this.value);
    });
    $('.colorpicker_holder').each(function(){
        var el = $(this).parent().find("input");
        var color = el.val().toUpperCase();
        el.val(color);
        $(this).css("backgroundColor", "#"+color );
        $(this).click(function(){
            $(this).parent().find("input").ColorPickerShow();
        });
    });
});
function check_colorpicker(el, hex){
    $(el).val(hex.toUpperCase());
    $(el).ColorPickerHide();
    $(el).parent().parent().find(".colorpicker_holder").css('backgroundColor', '#' + hex);
    var pos = el.id;
}
</script>
</HEAD>
<BODY>
...
</BODY>
</HTML>


웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/588
2009/10/10 22:49 2009/10/10 22:49

댓글을 달아 주세요

  1. 이창희 2010/08/10 19:23  댓글주소  수정/삭제  댓글쓰기

    좋은 정보 감사합니다~~~

  2. 포토샵이라면.. 2010/01/26 11:59  댓글주소  수정/삭제  댓글쓰기

    포토샵이라면 모든지 좋아요^^

  3. 비밀방문자 2010/01/22 15:25  댓글주소  수정/삭제  댓글쓰기

    관리자만 볼 수 있는 댓글입니다.

  4. 하얀방울 2009/10/15 11:14  댓글주소  수정/삭제  댓글쓰기

    좋은정보 감사합니다. 담아갈께요.

  5. 김규진 2009/10/14 16:11  댓글주소  수정/삭제  댓글쓰기

    와 좋은데요

간단한 시계 가젯을 만들어 보겠습니다. 우선 구글에 로그인하고 구글 가젯 에디터(Google Gadget Editor) 정보 페이지에서 "바로 추가" 버튼을 클릭하면 아이구글(iGoogle)에 가젯을 편집할 수 있는 위젯이 추가 됩니다. 에디터에 아래 보이는 시계 가젯 소스를 입력한 후 적당한 파일명(simpleclock.xml)으로 저장(Save) 하고 발행(Publish) 버튼을 누릅니다.

사용자 삽입 이미지

그리고 "Add to my iGoogle page" 링크를 클릭하면 발행한 가젯을 내 아이구글 페이지에 붙일 수 있습니다. "Publish to iGoogle Directory" 링크를 클릭하면 아이구글 가젯 디렉토리에 발행할 수 있습니다. "Add to a webpage" 링크를 클릭하면 네 홈페이지나 블로그로 가져와서 붙일 수 있는 코드를 생성해 주는 페이지로 이동합니다. 바로 아래 보이는 시계는 완성된 가젯의 코드를 가져와 본 게시물에 코드를 추가해서 보여지는 것입니다. 구글 가젯 개발에 관심이 있는 분은 구글 가젯 API 개발 페이지에서 관련 정보를 확인해보세요.

[시계 가젯 코드 가져와서 띄운 화면]

[시계 가젯을 만들기 위한 소스 코드]
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="HOMPY CLOCK" directory_title="HOMPY CLOCK" description="HOMPY CLOCK" category="tools" screenshot="http://www.hompydesign.com/images/gadget/simpleclock.jpg" thumbnail="http://www.hompydesign.com/images/gadget/simpleclock.jpg" title_url="hompy.info/584" author="hompy" author_email="hompy.info@gmail.com" author_link="http://hompy.info/584" author_location="Korea, Seoul" author_affiliation="hompydesign.com" width="180" height="48" scrolling="false" author_aboutme="web programmer" />
<UserPref name="bgcolor" display_name="배경색" default_value="#99aa99"/>
<UserPref name="datecolor" display_name="날짜색" default_value="#ffffff"/>
<UserPref name="timecolor" display_name="시간색" default_value="darkgreen"/>
<Content type="html">
<![CDATA[
<div id="my_content">
<div id="my_date"></div>
<div id="my_clock"></div>
</div>
<style>
#my_content { font-size : 12px; padding : 5px; background-color:#99aa99;}
#my_date {font-family:verdana,돋음; font-size : 11px; color : #ffffff; padding : 2px; text-align : left; }
#my_clock {font-family:verdana,돋음; font-size : 14px; color : darkgreen; padding : 2px; text-align : center; font-weight : bold; background-color:#ffffff; }
</style>

<script type="text/javascript">
var prefs = new gadgets.Prefs();
function init_clock() {
      var params = {};
      var bgcolor, datecolor, timecolor;
      params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;
      params[gadgets.io.RequestParameters.REFRESH_INTERVAL] = 10 * 60;
      bgcolor = prefs.getString("bgcolor");
      datecolor = prefs.getString("datecolor");
      timecolor = prefs.getString("timecolor");
      document.getElementById('my_content').style.backgroundColor = bgcolor;
      document.getElementById('my_date').style.color = datecolor;
      document.getElementById('my_clock').style.color = timecolor;
      print_hour();
      window.setInterval("print_hour()", 100);
}

function print_hour(){
      var today = new Date();
      var year = today.getFullYear();
      var month = today.getMonth()+1;
      var date = today.getDate();
      var hour = today.getHours();
      var min = today.getMinutes();
      var sec = today.getSeconds();
      document.getElementById('my_date').innerHTML = year + '-' + get_number_str(month) + '-' + get_number_str(date);
      document.getElementById('my_clock').innerHTML = get_number_str(hour) + ':' + get_number_str(min) + ' ' + get_number_str(sec);
}

function get_number_str(num){
      if (num<10) num = '0' + num;
      return num;
}

gadgets.util.registerOnLoadHandler(init_clock);
</script>
]]>
</Content>
</Module>

[구글 가젯 에디터]

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/584
2009/07/05 17:03 2009/07/05 17:03

댓글을 달아 주세요

야후 세계 지도 API 를 활용해서 지도를 만드는 비교적 간단한 샘플입니다. 아래 소개된 소스 코드를 실행하면 100개의 마커가 뿌려지고 해당 마커를 클릭하면 이미지를 보여주는 다음과 같은 실행 화면을 확인할 수 있습니다. 자신의 홈페이지에서 테스트 하기 위해서는 야후 거기 지도 오픈 API 키를 해당 홈페이지 (http://kr.open.gugi.yahoo.com/Regist/regist.php) 에서 얻을 수 있으며 키 값($yahoo_map_api_key)을 얻은 API 키로 교체해야 합니다. 참고로 구글 지도 API에도 관심이 있는 분은 앞서 소개한 "자바스크립트로 지도 만들기, 구글 지도 API 매시업(Mashup)" 포스트도 참고하세요.

[실행 화면] http://www.hompydesign.com/map/yahoo.html


[소스 코드]
<HTML>
<HEAD>
<TITLE><?=$hompy_title?></TITLE>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="http://kr.open.gugi.yahoo.com/Client/AjaxMap.php?v=3.7&appid=$yahoo_map_api_key"></script>
<style type="text/css">

#map_box {position:relative;}
#map_canvas { width: 578px; height: 460px; margin: 0; padding: 0; border: 0; }

#map_box {width:578px; border: 4px solid #cccccc; padding:2px;}
#display_loading_box {width:578px; height:460px; position:absolute; background-color:#000000; z-index:1000; opacity: 0.5; filter: alpha(opacity = 50);}
#display_loading_box_icon {margin: 214px 273px; width:32px; height:32px;}

body,td,tr { font-size:12px; font-family:돋움,verdana,arial,sans serif;}

.window_image {border:1px solid #cccccc; width:140px; height:100px; margin:6px;}

</style>
<script type='text/javascript'>
<!--

var map = null;
var current_lon = 127.046;
var current_lat = 37.5066;
var current_zoom = 14;
var person_list = [];

$(document).ready(function(){
      display_loading();
      map = new YMap($("#map_canvas")[0]);

      map.addTypeControl();
      map.addZoomLong();
      map.addPanControl();
      //map.drawZoomAndCenter(encodeURIComponent("강남역"), 4);
      map.drawZoomAndCenter(new YGeoPoint(current_lat,current_lon), 4);
      map.setMapType(YAHOO_MAP_REG);

      display_marker({user:0,lat:current_lat,lon:current_lon});
      for (record in person_list) {
            display_marker(person_list[record]);
      }
      setTimeout(display_loaded, 1000);
});

function display_loading(){
      var html = "<div id='display_loading_box'><img src='images/loading.gif' id='display_loading_box_icon' /></div>";
      $('#map_canvas').before(html);
}

function display_loaded(){
      $('#display_loading_box').remove();
}

function display_marker(record){
      with (record) {
            var point = new YGeoPoint(Number(lat),Number(lon));
            var marker = create_marker(point, user);
      }
      map.addOverlay(marker);
      //map.setCenter(point, current_zoom, G_NORMAL_MAP);
}

function create_marker(point, person) {
      var icon = new YImage();
      icon.src = 'images/pot.png';;
      icon.size = new YSize(36, 36);
      icon.offset.x = -18; icon.offset.y = 0;      

      var marker= new YMarker(point, icon);
      //marker.addAutoExpand("pos:"+person);
      var html = '<a href="http://hompy.info/583"><img src="/hompydesign.com?seq='+person+'" class="window_image"></a>';
      YEvent.Capture(marker, EventsList.MouseClick, function(){
            marker.openSmartWindow(html);
      });
      return marker;
}

person_list =
[{user:1,lon:127.034,lat:37.5059},{user:2,lon:127.029,lat:37.5125},{user:3,lon:127.032,lat:37.5306},{user:4,lon:127.034,lat:37.4994},{user:5,lon:127.036,lat:37.5169}];

-->
</script>
</HEAD>

<BODY>
<div id="map_box">
<div class="map" id="map_canvas"></div>
</div>
</BODY>
</HTML>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/583
2009/06/26 20:51 2009/06/26 20:51

댓글을 달아 주세요

  1. 비밀방문자 2009/07/01 11:36  댓글주소  수정/삭제  댓글쓰기

    관리자만 볼 수 있는 댓글입니다.

다음 지도 API 를 활용해서 지도를 만드는 비교적 간단한 샘플입니다. 아래 소개된 소스 코드를 실행하면 100개의 마커가 뿌려지고 해당 마커를 클릭하면 이미지를 보여주는 다음과 같은 실행 화면을 확인할 수 있습니다. 자신의 홈페이지에서 테스트 하기 위해서는 다음 지도 API 키를 해당 홈페이지 (https://apis.daum.net/register/mapsapi.daum) 에서 얻을 수 있으며 키 값($daum_map_api_key)을 얻은 API 키로 교체해야 합니다. 참고로 구글 지도 API에도 관심이 있는 분은 앞서 소개한 "자바스크립트로 지도 만들기, 구글 지도 API 매시업(Mashup)" 포스트도 참고하세요.

[실행 화면] http://www.hompydesign.com/map/daum.html


[소스 코드]
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE><?=$hompy_title?></TITLE>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="http://apis.daum.net/maps/maps.js?apikey=<?=$daum_map_api_key;?>" charset="utf-8"></script>
<style type="text/css">

#map_box {position:relative;}
#map_canvas { width: 578px; height: 460px; margin: 0; padding: 0; border: 0; }

#map_box {width:578px; border: 4px solid #cccccc; padding:2px;}
#display_loading_box {width:578px; height:460px; position:absolute; background-color:#000000; z-index:1000; opacity: 0.5; filter: alpha(opacity = 50);}
#display_loading_box_icon {margin: 214px 273px; width:32px; height:32px;}

body,td,tr { font-size:12px; font-family:돋움,verdana,arial,sans serif;}

.window_image {border:1px solid #cccccc; width:140px; height:100px; margin:6px;}

</style>
<script type='text/javascript'>
<!--

var map = null;
var current_lon = 127.046;
var current_lat = 37.5066;
var current_zoom = 14;
var person_list = [];

$(document).ready(function(){
      display_loading();
      map = new DMap("map_canvas");
      map.setCenter(new DLatLng(current_lat, current_lon), 4);
      //map.addControl(new DIndexMapControl());
      map.addControl(new DZoomControl());

      display_marker({user:0,lat:current_lat,lon:current_lon});
      for (record in person_list) {
            display_marker(person_list[record]);
      }
      setTimeout(display_loaded, 1000);
});

function display_loading(){
      var html = "<div id='display_loading_box'><img src='images/loading.gif' id='display_loading_box_icon' /></div>";
      $('#map_canvas').before(html);
}

function display_loaded(){
      $('#display_loading_box').remove();
}

function display_marker(record){
      var icon = new DIcon("http://localimg.daum-img.net/localimages/07/2008/map/i_mks_b1.gif", new DSize(13, 16));
      var point = new DLatLng(Number(record.lat),Number(record.lon));
      var marker = create_marker(point, record.user);
      map.addOverlay(marker, {mark:icon});
      //map.addOverlay(marker);
}

function create_marker(point, person) {
      var html = '<a href="http://hompy.info/582"><img src="/hompydesign.com?seq='+person+'" class="window_image"></a>';
      var marker= new DMark(point, { infowindow : new DInfoWindow(html), draggable : false });
      //marker.addAutoExpand("pos:"+person);
      return marker;
}

person_list =
[{user:1,lon:127.034,lat:37.5059},{user:2,lon:127.029,lat:37.5125},{user:3,lon:127.032,lat:37.5306},{user:4,lon:127.034,lat:37.4994},{user:5,lon:127.036,lat:37.5169}];

-->
</script>
</HEAD>

<BODY>
<div id="map_box">
<div class="map" id="map_canvas"></div>
</div>
</BODY>
</HTML>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/582
2009/06/25 21:13 2009/06/25 21:13

댓글을 달아 주세요

  1. 질문이요! 2011/03/24 18:54  댓글주소  수정/삭제  댓글쓰기

    지도 키 발급 받을때요~ http://www.test.com/ 이렇게 도메인으로만 받으면 안되는건가요?? 전 자꾸 스크립트 에러가 떠서 ㅠㅠ

    그리고 저 소스 그대로 긁어다가
    키만 바꿔줬는데 백지로 나옵니다 ㅠ

  2. 임채경 2010/06/23 11:15  댓글주소  수정/삭제  댓글쓰기

    항상 유용한 정보를 눈팅으로만 보고가다가 감사인사 올립니다.
    도움이 많이 되고 있습니다. 감사해요^^

네이버 지도 API 를 활용해서 지도를 만드는 비교적 간단한 샘플입니다. 아래 소개된 소스 코드를 실행하면 100개의 마커가 뿌려지고 해당 마커를 클릭하면 이미지를 보여주는 다음과 같은 실행 화면을 확인할 수 있습니다. 자신의 홈페이지에서 테스트 하기 위해서는 네이버 지도 API 키를 해당 홈페이지 (http://dev.naver.com/openapi/register) 에서 얻을 수 있으며 키 값($naver_map_api_key)을 얻은 API 키로 교체해야 합니다. 참고로 구글 지도 API에도 관심이 있는 분은 앞서 소개한 "자바스크립트로 지도 만들기, 구글 지도 API 매시업(Mashup)" 포스트도 참고하세요.

[실행 화면] http://www.hompydesign.com/map/naver.html


[소스 코드]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?=$hompy_title?></title>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="http://map.naver.com/js/naverMap.naver?key=<?=$naver_map_api_key?>"></script>
<style type="text/css">

#map_box {position:relative;}
#map_canvas { width: 578px; height: 460px; margin: 0; padding: 0; border: 0; }

#map_box {width:578px; border: 4px solid #cccccc; padding:2px;}
#display_loading_box {width:578px; height:460px; position:absolute; background-color:#000000; z-index:1000; opacity: 0.5; filter: alpha(opacity = 50);}
#display_loading_box_icon {margin: 214px 273px; width:32px; height:32px;}

body,td,tr { font-size:12px; font-family:돋움,verdana,arial,sans serif;}

.window_image {border:1px solid #cccccc; width:140px; height:100px;}

</style>
<script type="text/javascript">

var map;
var tm128 = new NPoint(315741,544301);
var latlng;
var person_list;
var infowin;

$(document).ready(function(){
      display_loading();
      map = new NMap($('#map_canvas')[0],578,460);
      map.setCenterAndZoom(tm128, 4);
      //map.addControl(new NIndexMap());
      map.addControl(new NZoomControl());
      map.addControl(new NMapBtns());
      map.enableWheelZoom();
      for (record in person_list) {
            display_marker(person_list[record]);
      }
      display_marker({user:0,lon:127.046,lat:37.5066});
      map.setCenter(latlng);

      NEvent.addListener(map,"click",function (latlng){
            if (infowin) map.removeOverlay(infowin);
      });

      NEvent.addListener(map,"startDrag",function (latlng){
            if (infowin) map.removeOverlay(infowin);
      });
      setTimeout(display_loaded, 1000);
});

function transFromTM128ToLatLng() {
      latlng = map.fromTM128ToLatLng(tm128);
      document.getElementById("display").innerHTML = latlng;
}

function moveLatLng() {
      map.setCenter(latlng);
}

function display_marker(record) {
      latlng = new NLatLng(record.lat, record.lon);
      var marker = new NMark(latlng, new NIcon('http://static.naver.com/maps/ic_spot.png',new NSize(52,41),new NSize(14,40)));
      var html = '<a href="http://hompy.info/580"><img src="/hompydesign.com?seq='+record.user+'" class="window_image"></a>';
      map.addOverlay(marker);
      NEvent.addListener(marker,"click",function (latlng){
            if (infowin) map.removeOverlay(infowin);
            infowin = new NInfoWindow();
            map.addOverlay(infowin);
            infowin.set(latlng, "<TABLE style='width:100px;height:50px;background-color:#FFFFFF; border:solid 1px #666666'><TR><TD>"+html+"</TD></TR></TABLE>");
            infowin.showWindow();
            //NEvent.addListener(infowin,"mouseout",function () {infowin.hideWindow();});
      });
}

function display_loading(){
      var html = "<div id='display_loading_box'><img src='images/loading.gif' id='display_loading_box_icon' /></div>";
      $('#map_canvas').before(html);
}

function display_loaded(){
      $('#display_loading_box').remove();
}

person_list =
[{user:1,lon:127.034,lat:37.5059},{user:2,lon:127.029,lat:37.5125},{user:3,lon:127.032,lat:37.5306},{user:4,lon:127.034,lat:37.4994},{user:5,lon:127.036,lat:37.5169}];

</script>
</head>
<body>

<div id="map_box">
<div class="map" id="map_canvas"></div>
</div>

</body>
</html>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/581
2009/06/24 20:41 2009/06/24 20:41

댓글을 달아 주세요

  1. 비밀방문자 2011/04/06 16:30  댓글주소  수정/삭제  댓글쓰기

    관리자만 볼 수 있는 댓글입니다.

  2. 최소청 2010/05/25 15:41  댓글주소  수정/삭제  댓글쓰기

    안녕하세요 ^^
    소스를 참고하여 지도 API를 이용한 인물검색시
    "대구광역시 북구"를 검색하게되면
    대구광역시 북구에 사시는 분들이
    마커점이 찍히도록 하고 싶습니다.

    그런데 위에 소스는 강제적으로 마크점이 찍히는 부분을
    정해서 넣은 소스잖아요 ^^

    저 부분을 어떻게 수정을해야 디비에 저장되어 있는 분들을
    지도상에 마커점이 찍히도록 할 수 있습니까~?

    쫌 알려주세요 ㅠㅠ 부탁드립니다 ~

  3. fdsfdsafasdfds 2009/11/13 17:50  댓글주소  수정/삭제  댓글쓰기

    person_list = [{user:1,lon:127.034,lat:37.5059},

    소스를 보니 수동으로 5개를 넣는 소스 이더군요..


    db에 있는 자료의 주소값을 수시로 예를 들어 강남구 역삼동 124,124,125 ......

    처럼 주소값을 lon,lat처럼 위치값으로 어떻게 변화를 시키나요...

    네이버의 geocode.php는 일일히 한개의 주소값(서울시 강남구 역삼동)을

    대입시켜 x,y값만을 뽑아 와야 하는데 여기의 lon,lat값은 사용자가

    어떻게 입력(주소를 lon,lat)값으로 변환시킬수 있나요...

    간절히 부탁드립니다. 일주일 내내 삽집하니 너무 지쳐서요...

  4. 박중호 2009/07/14 18:02  댓글주소  수정/삭제  댓글쓰기

    잘 보고 갑니다.
    유용한 자료 감사합니다.
    그런데 저기 이미지는 어디서가져 왔는지요..ㅜㅜ
    직접 링크를 시키셨나요?

구글 지도 API 를 활용해서 지도를 만드는 비교적 간단한 샘플입니다. 아래 소개된 소스 코드를 실행하면 100개의 마커가 뿌려지고 해당 마커를 클릭하면 이미지를 보여주는 다음과 같은 실행 화면을 확인할 수 있습니다. 자신의 홈페이지에서 테스트 하기 위해서는 구글 지도 API 키를 해당 홈페이지 (http://code.google.com/apis/maps/) 에서 얻을 수 있으며 키 값($google_map_api_key)을 얻은 API 키로 대입해야 합니다.

[실행 화면] http://www.hompydesign.com/map/


[소스 코드]
<HTML>
<HEAD>
<TITLE><?=$hompy_title?></TITLE>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?=$google_map_api_key?>"></script>
<style type="text/css">

#map_box {position:relative;}
#map_canvas { width: 578px; height: 460px; margin: 0; padding: 0; border: 0; }

#map_box {width:578px; border: 4px solid #cccccc; padding:2px;}
#display_loading_box {width:578px; height:460px; position:absolute; background-color:#000000; z-index:1000; opacity: 0.5; filter: alpha(opacity = 50);}
#display_loading_box_icon {margin: 214px 273px; width:32px; height:32px;}

body,td,tr { font-size:12px; font-family:돋움,verdana,arial,sans serif;}

</style>
<script type='text/javascript'>
<!--

var map = null;
var current_lon = 127.046;
var current_lat = 37.5066;
var current_zoom = 14;
var person_list = [];

$(document).ready(function(){
      display_loading();
      map = new google.maps.Map2($("#map_canvas")[0]);
      map.disableDoubleClickZoom();
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.addControl(new GScaleControl());
      map.enableScrollWheelZoom();
      map.setCenter(new GLatLng(current_lat, current_lon), current_zoom);
      display_marker({user:0,lat:current_lat,lon:current_lon});
      for (record in person_list) {
            display_marker(person_list[record]);
      }
      setTimeout(display_loaded, 1000);
});

function display_loading(){
      var html = "<div id='display_loading_box'><img src='images/loading.gif' id='display_loading_box_icon' /></div>";
      $('#map_canvas').before(html);
}

function display_loaded(){
      $('#display_loading_box').remove();
}

function display_marker(record){
      with (record) {
            var point = new GLatLng(Number(lat),Number(lon));
            var marker = create_marker(point, user);
      }
      map.addOverlay(marker);
      //map.setCenter(point, current_zoom, G_NORMAL_MAP);
}

function create_marker(point, person) {
      var icon = new GIcon(G_DEFAULT_ICON);
      if (person) {
            icon.image = "images/marker"+(person%10)+".png";
            icon.iconSize = new GSize(20,34);
      }
      var marker = new GMarker(point,{'icon': icon});
      marker.person = person;
      GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml('<img src="/hompydesign.com?seq='+person+'" width=140 height=100>');
      });
      return marker;
}

person_list =
[{user:1,lon:127.034,lat:37.5059},{user:2,lon:127.029,lat:37.5125},{user:3,lon:127.032,lat:37.5306},{user:4,lon:127.034,lat:37.4994},{user:5,lon:127.036,lat:37.5169}];

-->
</script>
</HEAD>

<BODY>
<div id="map_box">
<div class="map" id="map_canvas"></div>
</div>
</BODY>
</HTML>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/580
2009/06/21 12:52 2009/06/21 12:52

댓글을 달아 주세요

  1. 김아름 2010/02/16 14:25  댓글주소  수정/삭제  댓글쓰기

    사용해봤는데 일부러 고쳐서쓰라고 제대로 작동안되게 하신건가요?
    실수한건 아닌것 같고 일부러 그러신것 같네요
    다른사람이 노력해서 얻은 결과물을 아무 노력없이 얻으려는 마음은
    조금 없지않아 있지만 적어도 고쳐서 쓰라고 얘기는 해줬으면 좋겠네요
    한번 사용해 봤습니다. 다른곳엔 쓰지 않겠습니다

  2. Mizix 2009/07/23 16:45  댓글주소  수정/삭제  댓글쓰기

    이거 스크랩 해가도 되나요? ^^
    출처는 당연히 남기구요..

  3. 웹프로그래머 2009/07/14 07:14  댓글주소  수정/삭제  댓글쓰기

    jQuery 에 대해서 궁금하신 분들은 jQuery 관련 게시물과 jQuery 문서를 참고하세요.
    http://hompy.info/tag/jQuery
    http://docs.jquery.com/

  4. 나무 2009/07/13 18:28  댓글주소  수정/삭제  댓글쓰기

    저도 궁금한데 jquery.js 파일은 뭐죠??
    아 웹.. 초보인데 어딜가도 명쾌한 해답을 해주는 곳이 없네요 ㅠ

  5. 성의재 2009/07/02 19:19  댓글주소  수정/삭제  댓글쓰기

    <script type="text/javascript" src="/js/jquery.js"></script>
    이 부분의 jquery.js 파일은 제 홈페이지 안에 있어야 하는 파일인가요?

  6. 버파 2009/06/22 21:56  댓글주소  수정/삭제  댓글쓰기

    저 이거 블로그에 쓰고싶은데요 블로그 html로하면 헤드부분을 못쓰는데 어떻게해요?

자바스크립트 프레임워크 jQuery 를 활용해서 텍스트 입력 박스 (TextArea) 에 크기 조절 막대를 추가해 봅시다. 아래 소개한 소스를 실행하면 입력 박스 하단에 막대가 추가 되며 이 막대를 위 아래로 드래그 할 수 있으며 드래그 방향에 따라 텍스트 박스 크기를 늘리거나 줄일 수 있습니다.

[크기 조절 막대 예제 자바스크립트 소스 코드]
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>TextArea Resize Demo</title>
<style type="text/css">
#in_content {width:511px; height:40px; border:1px solid #666666}
.resize_bar {background: url("images/resize_bar.gif"); cursor:s-resize; height:12px; width:100%;}
</style>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type='text/javascript'>
<!--
jQuery.fn.resizehandle = function() {
      return this.each(function() {
            var me = jQuery(this);
            me.after(
                  jQuery('<div class="resize_bar"></div>')
                        .bind('mousedown', function(e) {
                              var h = me.height();
                              var y = e.clientY;
                              var movehandler = function(e) {
                                    me.height(Math.max(40, e.clientY + h - y));
                              };
                              var uphandler = function(e) {
                                    jQuery('html').unbind('mousemove',movehandler)
                                          .unbind('mouseup',uphandler);
                              };
                              jQuery('html') .bind('mousemove', movehandler)
                                    .bind('mouseup', uphandler);
                        })
            );
      });
}
$(document).ready(function(){
      $("textarea").resizehandle();
});
</script>
</head>
<body>

<table cellspacing=0 cellpadding=0 border=0><tr><td>
<textarea name="in_content" id="in_content">아래 크기조절 막대를 이동해보세요.</textarea>
</td></tr></table>
</body>
</html>

[크기 조절 막대 예제 실행 결과]

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/577
2009/06/07 11:54 2009/06/07 11:54

댓글을 달아 주세요

  1. 플모 2009/08/06 14:31  댓글주소  수정/삭제  댓글쓰기

    ㅜ 13번라인

자바스크립트 프레임워크 라이브러리 jQuery의 애니메이션 관련 메소드를 이용해서 학습용 이미지 슬라이더와 전광판을 만들어 봤습니다. jQuery의 "animate()"라는 메소드로 개별 엘리먼트에 모션 이펙트를 부여할 수 있으며 자바스크립트 메소드인 "setInterval()" 를 이용해서 끊임없이 반복되는 애니메이션을 만들 수 있습니다. jQuery 의 "hover()" 이벤트 핸들러와 자바스크립트 "clearInterval()" 메소드를 활용해서 잠시 멈춤 효과를 만들 수 있지요. 추가로 "jQuery Easing v1.3"을 활용해서 다양한 이펙트 옵션을 테스트 할 수 있도록 했습니다. 하단부에 있는 옵션명을 클릭하면 개별 이펙트를 확인할 수 있습니다.

[전광판과 이미지 슬라이더 실행 화면]
http://www.hompydesign.com/javascript/animate/


[전광판과 이미지 슬라이더 소스 코드]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Animate</title>
<link type="text/css" href="/ui/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.easing.1.3.js"></script>
<style type="text/css">
body {font-size: 12px; font-family:"Dotum", "Tahoma";}
img {border:0px;}
a:link {color:#3366CC; text-decoration:none;}
a:active {color:#FF9966; text-decoration:none;}
a:visited {color:#3366CC; text-decoration:none;}
a:hover {color:#FF9966; text-decoration:underline;}

.body {width:440px; height:280px; border:1px solid #CCCCCC; padding:10px; background-color:#FAFDE2}
#navi_tool {position:relative; width:400px; height:16px; overflow:hidden;}
#navi {position:absolute; left:0px; top:0px;}
#navi div {height:20px;}

#album_tool {position:relative; width:380px; height:120px; overflow:hidden;}
#album {position:absolute; width:2000px; left:0px; top:0px;}
#album div {float:left; margin:0px; padding:0px;}
</style>
<script type="text/javascript">
$(document).ready(function(){
    $("#navi").attr("motion", "easeInOutSine");
    $("#album").attr("motion", "easeInOutExpo")

    $("#navi").attr("top", "0");
    $("#album").attr("top", "0")

    $("#navi").attr("height", $("#navi>div").eq(0).height());
    $("#album").attr("width", $("#album>div").eq(0).width());

    $("#navi").attr("total", $("#navi>div").size());
    $("#navi>div").eq(0).clone().appendTo($("#navi"));
    $("#navi").hover(function(){
        clearInterval($("#navi").attr("timer"));
    },function(){
        $("#navi").attr("timer", setInterval(my_rotate, 3000));
        my_rotate();
    });
    $("#navi").attr("timer", setInterval(my_rotate, 3000));

    $("#album").attr("total", $("#album>div").size());
    $("#album>div").eq(0).clone().appendTo($("#album"));
    $("#album>div").eq(1).clone().appendTo($("#album"));
    $("#album").hover(function(){
        clearInterval($("#album").attr("timer"));
    },function(){
        $("#album").attr("timer", setInterval(my_album, 3000));
        my_album();
    });
    $("#album").attr("timer", setInterval(my_album, 3000));

    $("#motion_tool>a").click(function(){
        $("#navi").attr("motion", $(this).text());
        $("#album").attr("motion", $(this).text())
    });

});
function my_rotate(){
    if ($("#navi:animated").size()) return false;
    var height = $("#navi").attr("height");
    var pos = (parseInt($("#navi").attr("top"))+1);
    var px = pos * height;
    $("#navi").attr("top", pos);
    $("#navi").animate({
        top: ((px * -1) + "px")
    }, 1000, $("#navi").attr("motion"),
        function() {
            var pos = parseInt($("#navi").attr("top"));
            var total = parseInt($("#navi").attr("total"));
            if (pos>=total) {
                $("#navi").attr("top", 0);
                $("#navi").css("top", "0px");
            }
        }
    );
}
function my_album(){
    if ($("#album:animated").size()) return false;
    var width = $("#album").attr("width");
    var pos = (parseInt($("#album").attr("top"))+1);
    var px = pos * width;
    $("#album").attr("top", pos);
    $("#album").animate({
        left: ((px * -1) + "px")
    }, 1000, $("#album").attr("motion"),
        function() {
            var pos = parseInt($("#album").attr("top"));
            var total = parseInt($("#album").attr("total"));
            if (pos>=total) {
                $("#album").attr("top", 0);
                $("#album").css("left", "0px");
            }
        }
    );
}
</script>
</head>
<body>
<div class="body">
<div class="demo">
<div id="navi_tool">
    <div id="navi">
        <div><a href="http://hompy.info/574" target="_blank">1. jQuery 애니메이트로 만들어보는 이미지 슬라이더와 전광판</a></div>
        <div><a href="http://hompy.info/569" target="_blank">2. 심심풀이용 플래시 타워 디펜스 게임들과 플레이 동영상</a></div>
        <div><a href="http://hompy.info/570" target="_blank">3. 잘만든 인기 플래시 게임 버블탱크2와 젬크래프트</a></div>
        <div><a href="http://hompy.info/571" target="_blank">4. 포털에서 운영하는 채용정보 검색, 취업 검색, 취업 센터</a></div>
        <div><a href="http://hompy.info/572" target="_blank">5. jQuery를 활용한 홈페이지 개발의 기본인 입력폼 제작</a></div>
    </div>
</div>
<br />
<div id="album_tool">
    <div id="album">
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=1' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=2' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=3' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=4' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=5' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=6' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=7' width=190></a></div>
        <div><a href="http://hompy.info/24" target="_blank"><img src='http://www.hompydesign.com/hompydesign.com?no=8' width=190></a></div>
    </div>
</div>
<br />
<div id="motion_tool">
<a href="#">easeInQuad</a>
<a href="#">easeOutQuad</a>
<a href="#">easeInOutQuad</a>
<a href="#">easeInCubic</a>
<a href="#">easeOutCubic</a>
<a href="#">easeInOutCubic</a>
<a href="#">easeInQuart</a>
<a href="#">easeOutQuart</a>
<a href="#">easeInOutQuart</a>
<a href="#">easeInQuint</a>
<a href="#">easeOutQuint</a>
<a href="#">easeInOutQuint</a>
<a href="#">easeInSine</a>
<a href="#">easeOutSine</a>
<a href="#">easeInOutSine</a>
<a href="#">easeInExpo</a>
<a href="#">easeOutExpo</a>
<a href="#">easeInOutExpo</a>
<a href="#">easeInCirc</a>
<a href="#">easeOutCirc</a>
<a href="#">easeInOutCirc</a>
<a href="#">easeInElastic</a>
<a href="#">easeOutElastic</a>
<a href="#">easeInOutElastic</a>
<a href="#">easeInBack</a>
<a href="#">easeOutBack</a>
<a href="#">easeInOutBack</a>
<a href="#">easeInBounce</a>
<a href="#">easeOutBounce</a>
<a href="#">easeInOutBounce</a>
</div>
</div>
</body>
</html>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/574
2009/03/22 17:48 2009/03/22 17:48

댓글을 달아 주세요

  1. 비밀방문자 2009/06/12 13:37  댓글주소  수정/삭제  댓글쓰기

    관리자만 볼 수 있는 댓글입니다.

jQuery 자바스크립트 프레임워크 라이브러리를 이용하면 홈페이지 만들기의 기본인 입력폼을 비교적 손쉽게 만들 수 있습니다. 물론 단순한 양식 뿐만 아니라 입력 값이 유효한지 점검한다던지 날짜를 손쉽게 입력할 수 있도록 달력을 뿌려준다거나 새창 팝업 대신 레이어 팝업창을 손쉽게 띄워주고 있습니다. 그리고 파일 업로드 버튼을 이미지로 처리하는 부분과 버튼의 색이 바뀌고 입력창 크기를 조절하는 간단한 액션을 추가해서 생동감을 심어주는 부분도 있습니다. 아래 동영상을 보면 어떤 모습인지 확인 할 수 있고 이 영상은 동영상 아래 보이는 소스를 실행한 것입니다. 이에 대해 관심이 있는 분들은 jQuery 홈페이지에 있는 문서들을 참고하세요.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="웹프로그래머" />
<meta name="description" content="홈페이지 정보 블로그" />
<meta name="keywords" content="자바스크립트,jQuery,JavaScript,UI,datepicker,dialog,validate,filestyle,effects" />
<meta name="classification" content="자바스크립트,jQuery,JavaScript,UI,datepicker,dialog,validate,filestyle,effects" />
<title>홈페이지 정보 블로그 데모</title>
<link type="text/css" href="/theme/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.bgiframe.js"></script>
<script type="text/javascript" src="/js/jquery.validate.js"></script>
<script type="text/javascript" src="/js/jquery.filestyle.js"></script>
<script type="text/javascript" src="/ui/ui.core.js"></script>
<script type="text/javascript" src="/ui/ui.datepicker.js"></script>
<script type="text/javascript" src="/ui/ui.draggable.js"></script>
<script type="text/javascript" src="/ui/ui.resizable.js"></script>
<script type="text/javascript" src="/ui/ui.dialog.js"></script>
<script type="text/javascript" src="/ui/effects.core.js"></script>
<style type="text/css">
* { margin: 0; padding: 0; vertical-align: middle; }
a:link {color:#3366CC; text-decoration:none;}
a:active {color:#FF9966; text-decoration:none;}
a:visited {color:#3366CC; text-decoration:none;}
a:hover {color:#FF9966; text-decoration:underline;}
img { border: 0; }
body {font-family:돋움, verdana, arial, helvetica, sans-serif; font-size:12px; padding:10px;}

label {font-family:돋움, verdana, arial, helvetica, sans-serif; font-size:11px;}
label.error { float: none; color: red;       background: url('/images/icon_alert.gif') no-repeat left; padding-left:16px; padding-top:1px;}

.my_input_text { border-color:#999999; border-width: 1px; border-style:solid; font-size:12px; padding:2px 1px 1px;; background-color:#F9F9F9;}
.my_input_text.error { border-color:#FFC22B; background-color:#FFEDD6; }
.my_input_select { font-size:12px; background-color:#F9F9F9;}
.my_input_select.error { background-color:#FFEDD6; }
.my_input_check { background-color:#FFFFFF; }
.my_input_check.error { background-color:#FFFFFE; }

#my_title {font-size:14px; float:left;}
#my_content {padding:10px; width:430px; border-color:#EFEFEF; border-width: 3px; border-style:solid;}
#my_dialog {display:none}
#dialog_link {float:right; font-size:11px; padding-top:4px;}
#in_date {width:80px; margin-right:2px;}
#in_title {width:350px;}
#in_content {width:400px; height:60px;}
#in_form {magin:0px;}

.my_line {height:1px; background-color:#EFEFEF;}
.my_line2 {height:2px; background-color:#C4D2E2;}

#bt_submit {border:0px solid #EFEFEF; color:white; background-color:#666666; font-size:12px; padding:2px; cursor:pointer;}
#bt_reset {border:0px solid #EFEFEF; color:white; background-color:#666666; font-size:12px; padding:2px; cursor:pointer;}

#bt_plus_height {cursor:pointer; border:0px;}
#bt_minus_height {cursor:pointer; border:0px;}

.ui-datepicker-calendar td {padding:1px;}
.ui-datepicker-trigger {cursor:pointer;}
</style>
<script type="text/javascript">
$.validator.addMethod("alphanumeric", function(value, element) {
return this.optional(element) || /^\w[\w\s]*$/.test(value);
}, "알파벳이나 숫자를 입력하세요.");

$.validator.addMethod("mbmaxlength", function(value, element, param) {
      return this.optional(element) || value.length+(escape(value)+"%u").match(/%u/g).length-1<=param;
}, "글자수가 초과 되었습니다.");

$.ui.dialog.defaults.bgiframe = true;

$(document).ready(function(){
      $("#in_file").filestyle({
            image: "/images/icon_filefind.gif",
            imageheight : 20,
            imagewidth : 66,
            width : 284
      });

      $('#dialog').dialog({
            autoOpen: false,
            width: 360,
            modal: true,
            bgiframe: true,
            overlay: { backgroundColor: '#000', opacity: 0.5 },
            buttons: {
                  "확인": function() {
                        $(this).dialog("close");
                  },
                  "닫기": function() {
                        $(this).dialog("close");
                  }
            }
      });

      $('#dialog_link').click(function(){
            $('#dialog').dialog('open');
            return false;
      });

      $("#in_date").datepicker({
            maxDate: '+30d',
            minDate: '-0d',
            monthNames: ['년 1월','년 2월','년 3월','년 4월','년 5월','년 6월','년 7월','년 8월','년 9월','년 10월','년 11월','년 12월'],
            dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
            showMonthAfterYear:true,
            showOn: "both",
            showAnim: "show",
            showOptions: {},
            duration: 200,
            dateFormat: 'yy-mm-dd',
            buttonImage: "/ui/images/calendar.gif",
            buttonText: '달력',
            buttonImageOnly: true,
            onSelect: function(date) {
                  var date_arr = date.split('-');
                  if (date_arr.length==3){
                        var date_str = date_arr[0]+'년 '+date_arr[1]+'월 '+date_arr[2]+'일';
                        $("#span_in_last_date").html(date_str);
                  }
            },
            onClose: function(dateText) {
                  $('#in_date').valid();
            }
      })

$("#in_form").validate({
            submitHandler: function(form) {
                  if (!confirm("저장하겠습니까?")) return false;
                  form.submit();
                  return true;
            },
            rules: {
                  in_format: { required: true },
                  in_open: { required: true },
                  in_part: { required: true },
                  in_date: { required: true },
                  in_title: { required: true, minlength: 2, maxlength: 100 },
                  in_content: { required: true, minlength: 2, mbmaxlength: 8000 }
            },
            messages: {
                  in_format: { required: "형식을 선택하세요.<br>" },
                  in_open: { required: "공개방법을 선택하세요.<br>" },
                  in_part: { required: "말머리를 선택하세요.<br>" },
                  in_date: { required: "날짜를 입력하세요.<br>" },
                  in_title: {
                        required: "제목을 입력하세요.<br>",
                        minlength: "2자 이상으로 입력하세요.<br>",
                        maxlength: "100자 이하로 입력하세요.<br>"
                  },
                  in_content: {
                        required: "내용을 입력하세요.<br>",
                        minlength: "2자 이상으로 입력하세요.<br>",
                        mbmaxlength: "4000자 이하로 입력하세요.<br>"
                  }
            },
            errorPlacement: function(error, element) {
                  var er = element.attr("name");
                  error.appendTo( element.parent().find("span.my_error_display") );
            }
      });

      $('#bt_plus_height').click(function(){
            var h = parseInt($('#in_content').css("height"));
            if (h<400) $('#in_content').animate({height:h + 50},200,null);
      });

      $('#bt_minus_height').click(function(){
            var h = parseInt($('#in_content').css("height"));
            if (h>100) $('#in_content').animate({height:h - 50},200,null);
      });

      $("#bt_submit,#bt_reset").hover(
            function (){
                  $(this).stop();
                  $(this).animate({ backgroundColor: "#660000" }, 500);
            },
            function (){
                  $(this).stop();
                  $(this).animate({ backgroundColor: "#666666" }, 500);
            }
      );

});
</script>
</head>
<body>
<div id="my_container">

<div id="my_header">
</div>

<div id="my_sidebar">
</div>

<div id="my_content">
<form name="in_form" id="in_form" method="post" enctype="multipart/form-data">
<table id="my_table">
<tr><th colspan="2"><span id="my_title">자유게시판</span> <a href="#" id="dialog_link">도움말</a></th></tr>
<tr><td colspan="2" class="my_line2"></td></tr>
<tr><td>형식:</td><td><input type="checkbox" name="in_format" id="in_format" value="HTML" class="my_input_check" />HTML <input type="checkbox" name="in_format" id="in_format" value="BR" class="my_input_check" />BR <span class="my_error_display"></span></td></tr>
<tr><td colspan="2" class="my_line"></td></tr>
<tr><td>공개:</td><td><input type="radio" name="in_open" id="in_open" value="1" class="my_input_check" />전체 <input type="radio" name="in_open" id="in_sex" value="2" class="my_input_check" />일촌만 <span class="my_error_display"></span></td></tr>
<tr><td colspan="2" class="my_line"></td></tr>
<tr><td>말머리:</td><td>
<select name="in_part" id="in_part" class="my_input_select">
      <option value="">선택</option>
      <option value="1">잡담</option>
      <option value="2">의견</option>
      <option value="9">안내</option>
</select>
<span class="my_error_display"></span>
</td></tr>
<tr><td colspan="2" class="my_line"></td></tr>
<tr><td>날짜:</td><td><input type="text" name="in_date" id="in_date" class="my_input_text" readonly /> <span class="my_error_display"></span></td></tr>
<tr><td colspan="2" class="my_line"></td></tr>
<tr><td>파일:</td><td><span class="my_error_display"></span><input type="file" name="in_file" id="in_file" class="my_input_text" /></td></tr>
<tr><td colspan="2" class="my_line"></td></tr>
<tr><td>제목:</td><td><span class="my_error_display"></span><input type="text" name="in_title" id="in_title" class="my_input_text" /></td></tr>
<tr><td colspan="2" class="my_line"></td></tr>
<tr><td colspan="2">
      <img src="/images/icon_down.gif" id="bt_plus_height">
      <img src="/images/icon_up.gif" id="bt_minus_height">
</td></tr>
<tr><td colspan="2">
<span class="my_error_display"></span>
<textarea name="in_content" id="in_content" class="my_input_text"></textarea></td></tr>
<tr><td colspan="2"><input id='bt_submit' type="submit" value="저장" /> <input id="bt_reset" type="reset" value="취소" /></td></tr>
</table>
</form>
</div>

<div id="my_footer">
</div>

</div>

<div id="dialog" title="자유게시판 도움말">
자유게시판에 대해 설명합니다.
</div>

</body>

</html>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/572
2009/03/09 09:06 2009/03/09 09:06

댓글을 달아 주세요

  1. 쿠하하하 2011/07/27 15:47  댓글주소  수정/삭제  댓글쓰기

    좋은 자료 감사합니다. validation 체크해야해서 돌아다니다가 업어갑니다 ^^

  2. 숫돌 2009/11/07 19:34  댓글주소  수정/삭제  댓글쓰기

    안녕하세요 jquery 1.3.2버전이 자꾸 에러가 발생되어 작동이되지않습니다
    jquery 어떤버전을 사용하여 실행했는지 궁금합니다

  3. 웹프로그래머 2009/07/14 07:15  댓글주소  수정/삭제  댓글쓰기

    jQuery 에 대해서 궁금하신 분들은 jQuery 관련 게시물과 jQuery 문서를 참고하세요.
    http://hompy.info/tag/jQuery
    http://docs.jquery.com/

  4. 장난 2009/04/07 15:46  댓글주소  수정/삭제  댓글쓰기

    jquery js만 받아서 덮어씌움됨

  5. 나그네 2009/04/03 12:57  댓글주소  수정/삭제  댓글쓰기

    jquery 사이트가서 다운받으시면~

  6. 메이카홍 2009/03/31 10:30  댓글주소  수정/삭제  댓글쓰기

    소스를 구할수 없을까요 ? 너무 좋은 정보라서 구하고 싶습니다

    <script type="text/javascript" src="/ui/ui.dialog.js"></script>에 있는

    dialog.js 소스를 보고 싶습니다

자바스크립트 라이브러리인 jQuery UI 위젯(Widgets)을 이용해서 달력(Calendar)과 날짜입력기(DatePicker)를 내 블로그나 홈페이지에 붙여 활용해보세요. 쓸만한 달력을 직접 만들려면 상당한 공을 드려야 하지만 jQuery UI 위젯을 활용하면 손쉽게 달력을 이용할 수 있을 뿐만 아니라 다양한 설정도 할 수 있으며 스킨도 비교적 손쉽게 교체할 수 있습니다. 하단 예제 소스 코드와 실행 화면을 참고하시면 사용법을 대략 짐작하실 수 있을 것입니다.
참고로 자바스크립트 프레임워크 라이브러리에는 Prototype, Script.aculo.us, jQuery, YUI, Dojo Toolkit, Ext JS, Google Web Toolkit, MooTools 등이 있습니다. 그리고 달력을 직접 제작해보려면 이전에 소개한 "PHP 또는 자바스크립트로 달력 만들기 소스 코드" 게시물을 참고하세요.

[jQuery UI 홈페이지]
http://ui.jquery.com/
http://ui.jquery.com/demos/datepicker

[jQuery UI DatePicker 실행 화면]
http://www.hompydesign.com/javascript/calendar/


[jQuery UI DatePicker 예제 소스 코드]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery UI Datepicker</title>
<link type="text/css" href="/ui/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/ui/ui.core.js"></script>
<script type="text/javascript" src="/ui/effects.core.js"></script>
<script type="text/javascript" src="/ui/effects.blind.js"></script>
<script type="text/javascript" src="/ui/effects.drop.js"></script>
<script type="text/javascript" src="/ui/effects.explode.js"></script>
<script type="text/javascript" src="/ui/ui.datepicker.js"></script>
<style>
body {font-size: 62.5%; font-family:"Dotum", "Tahoma";}
.body {width:440px; height:280px; border:1px solid #CCCCCC; padding:10px; background-color:#FAFDE2}
.demo {width:330px; border:1px solid #CCCCCC; padding:10px; background-color:#FFFFFF}
.text {font-size:12px; margin-right:4px; width:80px; line-height:20px;}
.datepicker_input1 {border:1px solid #999999; margin-right:4px; width:70px;}
.datepicker_input2 {border:1px solid #999999; margin-right:4px; width:70px;}
.datepicker1_div {margin-right:10px; float:left;}
</style>
<script type="text/javascript">
$.datepicker.setDefaults({
    //monthNames: ['년 1월','년 2월','년 3월','년 4월','년 5월','년 6월','년 7월','년 8월','년 9월','년 10월','년 11월','년 12월'],
    //dayNamesMin: ['일', '월', '화', '수', '목', '금', '토'],
    //showMonthAfterYear:true,
    dateFormat: 'yy-mm-dd',
    buttonImageOnly: true,
    buttonText: "달력",
    buttonImage: "/ui/images/calendar.gif"
});
$(document).ready(function(){
    $("#datepicker2").val($.datepicker.formatDate($.datepicker.ATOM, new Date(2009, 1 - 1, 18)));
    $("#datepicker1").datepicker({
        inline: true,
        defaultDate: new Date(2009, 1 - 1, 18),
        onSelect: function(date) { $("#datepicker2").val(date); }
    })
    $("#datepicker2").datepicker({
        defaultDate: new Date(2009, 1 - 1, 27),
        showOn: "both", // focus, button, both
        showAnim: "blind", // blind, clip, drop, explode, fold, puff, slide, scale, size, pulsate, bounce, highlight, shake, transfer
        showOptions: {direction: 'horizontal'},
        duration: 200
    })
    $("#datepicker3").datepicker({
        defaultDate: new Date(2009, 1 - 1, 28),
        showOn: "both", // focus, button, both
        showAnim: "drop", // blind, clip, drop, explode, fold, puff, slide, scale, size, pulsate, bounce, highlight, shake, transfer
        showOptions: {direction: 'horizontal'},
        duration: 200
    })
    $("#datepicker4").datepicker({
        defaultDate: new Date(2009, 1 - 1, 29),
        showOn: "button", // focus, button, both
        showAnim: "explode",
        showOptions: {pieces: 4},
        duration: 500
    })
    $(".datepicker_input2").datepicker({
        defaultDate: new Date(2009, 1 - 1, 30),
        showOn: "both", // focus, button, both
        showAnim: "show", // show, fadeIn, slideDown
        duration: 200
    })
});
</script>
</head>
<body>
<div class="body">
<div class="demo">
<div id="datepicker1" class="datepicker1_div" /></div>
<span class="text">날짜</span> <input type="text" id="datepicker2" class="datepicker_input1"><br />
<span class="text">날짜</span> <input type="text" id="datepicker3" class="datepicker_input1"><br />
<span class="text">날짜</span> <input type="text" id="datepicker4" class="datepicker_input1"><br />
<span class="text">날짜</span> <input type="text" class="datepicker_input2"><br />
</div>
<br />
<span class="text">
jQuery UI Datepicker<br />
jQuery UI 날짜 입력기<br />
jQuery UI Calendar, 달력<br />
</span>
</div>
</body>
</html>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info/566
2009/01/27 10:29 2009/01/27 10:29

댓글을 달아 주세요

동적 HTML 객체 모델 요소의 위치와 면적 계산
Understanding Properties That Measure Element Dimension and Location

diagram of a sample page showing the DHTML Object Model properties that are related to the dimension and location of elements
diagram of a sample page showing the DHTML Object Model properties that are related to the dimension and location of elements
diagram of a sample page showing the DHTML Object Model properties that are related to the dimension and location of elements

예제 테스트 링크
http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/overview/measure.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Measure for Measure</TITLE>
<SCRIPT type="text/javascript">
<!--
var lastfunc = 1;
function split() {
    switch(lastfunc) {
        case 1: one(); break;
        case 2: two(); break;
        case 3: three(); break;
        case 4: four(); break;
        default: five(); break;
    }
}
function iebody() {
    // Sense the difference between Strict and Quirks mode
    return (document.compatMode != "BackCompat"? document.documentElement : document.body);
}
function one() {
lastfunc = 1;
report.value = "The style object contains information that was set in the inline style to position the object. The following values are reported for the various position and dimension properties on the style object for the DIV above:" + "\n\n";
report.value += " mydiv.style.top (string) = " + mydiv.style.top + "\n";
report.value += " mydiv.style.left (string) = " + mydiv.style.left + "\n";
report.value += " mydiv.style.height (string) = " + mydiv.style.height + "\n";
report.value += " mydiv.style.width (string) = " + mydiv.style.width + "\n";
report.value += " mydiv.style.pixelTop = " + mydiv.style.pixelTop + "\n";
report.value += " mydiv.style.pixelLeft = " + mydiv.style.pixelLeft + "\n";
report.value += " mydiv.style.pixelHeight = " + mydiv.style.pixelHeight + "\n";
report.value += " mydiv.style.pixelWidth = " + mydiv.style.pixelWidth + "\n";
report.value += " mydiv.style.posTop = " + mydiv.style.posTop + "\n";
report.value += " mydiv.style.posLeft = " + mydiv.style.posLeft + "\n";
report.value += " mydiv.style.posHeight = " + mydiv.style.posHeight + "\n";
report.value += " mydiv.style.posWidth = " + mydiv.style.posWidth + "\n";
// Cancel the generic click event for the body
window.event.cancelBubble = true;
}
function two() {
lastfunc = 2;
report.value = "Offset properties for the DIV above: \n";
report.value += " mydiv.offsetLeft = " + mydiv.offsetLeft + "\n";
report.value += " mydiv.offsetTop = " + mydiv.offsetTop + "\n";
report.value += " mydiv.offsetHeight = " + mydiv.offsetHeight + "\n";
report.value += " mydiv.offsetWidth = " + mydiv.offsetWidth + "\n";
report.value += "Offset properties for the BODY: \n";
report.value += " offsetLeft = " + iebody().offsetLeft + "\n";
report.value += " offsetTop = " + iebody().offsetTop + "\n";
report.value += " offsetHeight = " + iebody().offsetHeight + "\n";
report.value += " offsetWidth = " + iebody().offsetWidth + "\n";
// Cancel the generic click event for the body
window.event.cancelBubble = true;
}
function three() {
lastfunc = 3;
report.value = "Scroll values for the DIV above: \n";
report.value += " mydiv.scrollLeft = " + mydiv.scrollLeft + "\n";
report.value += " mydiv.scrollTop = " + mydiv.scrollTop + "\n";
report.value += " mydiv.scrollHeight = " + mydiv.scrollHeight + "\n";
report.value += " mydiv.scrollWidth = " + mydiv.scrollWidth + "\n";
report.value += "Scroll values for the BODY: \n";
report.value += " scrollLeft = " + iebody().scrollLeft + "\n";
report.value += " scrollTop = " + iebody().scrollTop + "\n";
report.value += " scrollHeight = " + iebody().scrollHeight + "\n";
report.value += " scrollWidth = " + iebody().scrollWidth + "\n";
// Cancel the generic click event for the body
window.event.cancelBubble = true;
}
function four() {
lastfunc = 4;
report.value = "";
report.value += " clientHeight for the BODY: " + iebody().clientHeight + "\n";
report.value += " clientWidth for the BODY:" + iebody().clientWidth + "\n";
report.value += " clientTop for the BODY:" + iebody().clientTop + "\n";
report.value += " clientLeft for the BODY:" + iebody().clientLeft + "\n";
report.value += " clientHeight for this TEXTAREA:" + report.clientHeight + "\n";
report.value += " clientWidth for this TEXTAREA: " + report.clientWidth + "\n";
report.value += " clientTop for this TEXTAREA:" + report.clientTop + "\n";
report.value += " clientLeft for this TEXTAREA:" + report.clientLeft + "\n";
// Cancel the generic click event for the body
window.event.cancelBubble = true;
}
function five() {
lastfunc = 5;
report.value = "The following x and y values are passed on the event object for this mouse click event: \n";
report.value += " window.event.x = " + window.event.x + "\n";
report.value += " window.event.y = " + window.event.y + "\n";
report.value += " window.event.offsetX = " + window.event.offsetX + "\n";
report.value += " window.event.offsetY = " + window.event.offsetY + "\n";
report.value += " window.event.screenX = " + window.event.screenX + "\n";
report.value += " window.event.screenY = " + window.event.screenY + "\n";
report.value += " window.event.clientX = " + window.event.clientX + "\n";
report.value += " window.event.clientY = " + window.event.clientY + "\n";
// Cancel the generic click event for the body
window.event.cancelBubble = true;
}
-->
</script>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
<META NAME="AUTHOR" CONTENT="InetSDK">
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="ROBOTS" CONTENT="noindex">

<!-- SAMPLE_STYLE_START -->
<LINK REL="stylesheet" HREF="/workshop/samples/samples.css" TYPE="text/css">
<!-- SAMPLE_STYLE_END -->
<STYLE type="text/css">
BODY {
    margin:0;
    border:10px solid #99ccff;
    padding:10px;
    font-family:arial;
    font-size:70%;
    background-color:white;
    color:black;
}
BUTTON {
    margin:2px;
}
#mydiv {
    overflow:scroll;
    margin:20px auto;
    background-color:white;
    padding:20px;
    border:10px solid #99ccff;
    font-size:150%;
}
#report {
    margin-top:25px;
    border:1px solid #cccccc;
    font-family:arial;
    width:90%;
}
</STYLE>
</HEAD>
<!--TOOLBAR_START-->
<!--TOOLBAR_EXEMPT-->
<!--TOOLBAR_END-->

<BODY onload="two()" onscroll="three()" onresize='split()' onclick="five()">
<DIV class="body">
<CENTER>

<!-- This DIV uses an inline style to test the style object above. -->
<DIV id="mydiv" onclick="one()" onscroll="three()" style="top:5px; left:5px; height:8em; width:90%;">
DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool! DHTML is so cool!
</DIV>

<button onclick=one()>Style Positions</button>
<button onclick=two()>Object Offset</button>
<button onclick=three()>Scroll Positions</button>
<button onclick=four()>Client Area</button>
<button onclick=five()>Event Object</button>

<TEXTAREA id="report" rows=12 style=""></TEXTAREA>

</CENTER>

<!-- START_PAGE_FOOTER -->
<BR><BR><BR>
<p class="viewsource">[Right-click and choose View Source from the shortcut menu.] </p>
<A class="copyright" HREF="http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm">&copy; 2007 Microsoft Corporation. All rights reserved. Terms of use.</A>
<!-- END_PAGE_FOOTER -->
</DIV>
</BODY>
</HTML>

2009/01/04 15:46 2009/01/04 15:46

댓글을 달아 주세요


※ 녹색은 네츠케이프, 혹은 익스플로러 전용으로만 사용되는 객체(속성,메소드)입니다

객체(Object)

속성(Property)

메소드(Method)

이벤트핸들러

(Event Handler)

Anchor

name

 

 

text

x

y

anchors array

length

 

 

Applet

 

applet's methods

 

applets array

length

 

 

Area

hash

 

onClick

host

onmouseOut

gostname

onmouseOver

href

 

pathname

 

port

 

protocol

 

search

 

target

 

Array

length

concat

 

join

pop

push

reverse

shift

slice

sort

unshjft

Button

form

blur

onClick

name

click

onmouseDown

type

focus

onmouseUp

value

 

 

Checkbox

checked

blur

onClick

defaultChecked

click

onmouseDown

form

focus

onmouseUp

name

 

 

type

 

 

value

 

 

Date

 

getDate

 

getDay

getFullYear

getHours

getMilliseconds

getMinutes

getMonth

getSeconds

getTime

getTimezoneOffset

getUTCDate

getUTCDay

getUTCFullYear

getUTCHours

getUTCMilliseconds

getUTCMinutes

getUTCMonth

getUTCSeconds

getYear

parse

setDate

setFullYear

setHours

setMilliseconds

setMinutes

setMonth

setSeconds

setTime

setUTCDate

setUTCHours

setUTCMilliseconds

setUTCMinutes

setUTCMonth

setUTCSeconds

setYear

goGMTString

toLocaleString

toString

toUTCString

UTC

valueOf

document

activeElement

clear

 

alinkColor

close

all

createElement

Anchor

createStylesheet

anchors

elementFromPoint

Applet

getSelection

applets

open

Area

write

bgColor

writeIn

body

 

charset

 

children

 

cookie

 

defaultCharset

 

domain

 

embed

 

embeds

 

expando

 

fgColor

 

Form

 

forms

 

Image

 

images

 

lastModified

 

Layer

 

layers

 

linkColor

 

Link

 

links

 

location

 

parentWindow

 

plugins

 

readyState

 

referrer

 

scripts

 

selection

 

styleSheets

 

title

 

URL

 

vlinkColor

 

FileUpload

form

blur

onBlur

name

focus

onFocus

type

select

onSelect

value

 

 

Form

action

reset

onReset

Button

submit

onSubmit

Checkbox

 

 

elements

 

 

encoding

 

 

FileUpload

 

 

Hidden

 

 

length

 

 

method

 

 

name

 

 

Password

 

 

Radio

 

 

Reset

 

 

Select

 

 

Submit

 

 

target

 

 

Text

 

 

Textarea

 

 

forms array

length

 

 

frames array

length

 

 

Hidden

form

 

 

name

type

value

History

current

back

 

length

foward

next

go

previous

 

history array

length

 

 

Image

border

 

onAbort

complete

onError

height

onLoad

hspace

 

lowsrc

 

name

 

src

 

vspace

 

width

 

x

 

y

 

images array

length

 

 

Layers

above

load

onBlur

background

moveAbove

onFocus

below

moveBelow

onmouseOut

bgColor

moveBy

onmouseOver

clip

moveTo

onmouseUp

document

moveToAbsolute

 

hidden

resizeBy

 

left

resizeTo

 

name

 

 

pageX

 

 

pageY

 

 

parentLayer

 

 

siblingAbove

 

 

siblingBelow

 

 

src

 

 

top

 

 

visibility

 

 

window

 

 

x

 

 

y

 

 

zindex

 

 

layers array

length

 

 

Link

hash

 

onClick

host

onmouseOut

hostname

onmouseOver

href

 

pathname

 

port

 

protocol

 

search

 

target

 

text

 

x

 

y

 

links array

length

 

 

location

hash

reload

 

host

replace

hostname

 

href

 

pathname

 

port

 

protocol

 

search

 

Math

E

abs

 

LN2

acos

LN10

asin

LOG2E

atan

LOG10E

atan2

PI

ceil

SQRT1_2

cos

SQRT2

exp

 

floor

 

log

 

max

 

min

 

pow

 

random

 

round

 

sin

 

sqrt

 

tan

MimeType

description

 

 

enabledPlugin

suffixes

type

mimeTypes array

length

 

 

navigator

appCodeName

javaEnabled

 

appMinorVersion

preference

appName

savePreferences

appVersion

taintEnabled

browserLanguage

 

cookieEnabled

 

cpuClass

 

languages

 

mimeTypes

 

platform

 

plugins

 

systemLanguage

 

userAgent

 

userLanguage

 

userProfile

 

Number

MAX_VALUE

toString

 

MIN_VALUE

valueOf

NaN

 

NEGATIVE_INFINITY

 

POSITIVE_INFINITY

 

Option

defaultSelected

 

 

index

selected

selectedIndex

text

value

options array

length

 

 

Password

defaultValue

blur

onBlur

form

focus

onChange

name

select

onFocus

type

 

onKeydown

value

 

onKeypress

 

 

onKeyup

 

 

onSelect

Plugin

description

refresh

 

filename

name

plugins array

length

 

 

Radio

checked

blur

onClick

defaultChecked

click

onmouseDown

form

focus

onmouseUp

name

 

 

type

 

 

value

 

 

radio array

length

 

 

Reset

form

blur

onClick

name

click

onmouseDown

type

focus

onmouseUp

value

 

 

screen

availHeight

 

 

availLeft

availTop

availWidth

BufferDepth

colorDepth

height

pixelDepth

updayeInterval

width

Select

form

blur

onChange

length

focus

name

 

options

 

selectedIndex

 

type

 

String

length

anchor

 

big

blink

bold

charAt

charCodeAt

concat

fixed

fontcolor

fontsize

formCharCode

indexOf

italics

lastIndexOf

link

match

replace

search

slice

small

split

strike

sub

substr

substring

sup

toLowerCase

toUpperCase

Submit

form

blur

onClick

name

click

onMouseDown

type

focus

onMouseUp

value

 

 

Text

defaultValue

blur

onBlur

form

click

onChange

name

focus

onFocus

type

select

onKeydown

value

 

onKeyup

 

 

onSelect

Textarea

defaultValue

blur

onBlur

form

click

onChange

name

focus

onFocus

type

select

onKeydown

value

 

onKeyup

 

 

onSelect

window

clientInformation

alert

onBlur

closed

back

onError

defaultStatus

blur

onFocus

dialogArguments

close

onLoad

dialogHeight

confirm

onResize

dialogLeft

find

onUnload

dialogLeft

focus

 

dialogTop

forward

 

dialogWidth

home

 

document

moveBy

 

event

moveTo

 

frames

navigate

 

history

open

 

innerHeight

print

 

innerWidth

prompt

 

length

resizeBy

 

location

resizeTo

 

locationbar

scroll

 

menubar

scrollBy

 

name

scrollTo

 

navigator

stop

 

offscreenBuffering

 

 

opener

 

 

outerHeight

 

 

outerWidth

 

 

pageXOffset

 

 

pageYOffset

 

 

parent

 

 

personalbar

 

 

screen

 

 

screenX

 

 

screenY

 

 

scrollbars

 

 

self

 

 

status

 

 

statusbar

 

 

toolbar

 

 

top

   

2009/01/04 13:57 2009/01/04 13:57

댓글을 달아 주세요

자바스크립트, 모서리가 둥근 테이블 만들기.

사용자 삽입 이미지

<html>
<head>
<title>모서리가 둥근 테이블 입니다.</title>
<script>
<!--
function round_table(objID) {
    var obj = document.getElementById(objID);
    var Parent, objTmp, Table, TBody, TR, TD;
    var bdcolor, bgcolor, Space;
    var trIDX, tdIDX, MAX;
    var styleWidth, styleHeight;
    Parent = obj.parentNode;
    objTmp = document.createElement('SPAN');
    Parent.insertBefore(objTmp, obj);
    Parent.removeChild(obj);
    bdcolor = obj.getAttribute('rborder');
    bgcolor = obj.getAttribute('rbgcolor');
    radius = parseInt(obj.getAttribute('radius'));
    if (radius == null || radius < 1) radius = 1;
    else if (radius > 6) radius = 6;
    MAX = radius * 2 + 1;
    Table = document.createElement('TABLE');
    TBody = document.createElement('TBODY');
    Table.cellSpacing = 0;
    Table.cellPadding = 0;
    for (trIDX=0; trIDX < MAX; trIDX++) {
        TR = document.createElement('TR');
        Space = Math.abs(trIDX - parseInt(radius));
        for (tdIDX=0; tdIDX < MAX; tdIDX++) {
            TD = document.createElement('TD');
            styleWidth = '1px'; styleHeight = '1px';
            if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
            else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
            else if (radius > 2) {
                if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
                if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
            }
            if (styleWidth != null) TD.style.width = styleWidth;
            if (styleHeight != null) TD.style.height = styleHeight;

            if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
            else if (tdIDX > Space && Space < MAX - tdIDX - 1) TD.style.backgroundColor = bgcolor;

            if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
            TR.appendChild(TD);
        }
        TBody.appendChild(TR);
    }
    Table.appendChild(TBody);
    Parent.insertBefore(Table, objTmp);
}
-->
</script>
</head>

<body>
<table id="ta" width="300" height="140" border="0" radius="3" rborder="blue" rbgcolor="#F8F8F8">
    <tr>
        <td>
            모서리가 둥근 테이블 입니다.
            <table id="taa" width="200" height="120" border="0" radius="6" rborder="darkgreen" rbgcolor="#F8F8F8">
                <tr>
                    <td>
                        모서리가 둥근 테이블.
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<script>
round_table("ta");
round_table("taa");
</script>
</body>
</html>
2009/01/03 14:26 2009/01/03 14:26

댓글을 달아 주세요

자바스크립트로 만든 더보기/접기(more/less)  소스입니다. 본 소스는 여러개의 게시물 중에 지정된 제한 높이 보다 긴 게시물만 더보기/접기 버튼을 일괄적으로 붙여주고 있습니다. 게시물 샘플 중에는 이미지가 포함된 것도 있고 플래시가 포함된 것도 있습니다. 구현 원리는 레이어 속성 중에 offsetHeight 속성으로 해당 레이어의 높이를 확인할 수 있고 이와 제한 높이를 비교해서 제한 높이 이외의 내용은 숨겨주고 바로 밑에 더보기 버튼을 붙여 주는 것입니다. 이는 서버 스크립트와 조합해서 블로그나 게시판에 적용해볼 수 있습니다. 이를 체험할 수 있는 하단에 제시된 HTML 소스의 실행화면은 아래 링크를 통해 확인할 수 있습니다. 자바스크립트 입문자 여러분들은 본 소스를 자신에 맞게 수정 개선해보시면 자바스크립트 학습에 도움이 될 것입니다.

[실행화면 확인 링크]
http://www.hompydesign.com/javascript/more/more_less.html

[더보기/접기 HTML 소스]
<HTML>
<HEAD>
<TITLE>More/Less TEST</TITLE>
<script type='text/javascript'>
<!--
var content_height = 112;
var content_idx_array = [1001,1002,1004,1005,1008];
var content_show_array = [];
var content_push_array = [];
for (i=0;i<content_idx_array.length;i++) {
    content_show_array[content_idx_array[i]] = 'div_show_' + content_idx_array[i];
    content_push_array[content_idx_array[i]] = 'div_push_' + content_idx_array[i];
}
function get_more_html(idx){
    return "<a href=\"javascript:print_more('"+idx+"')\">--- [더보기] ---</a>";
}
function get_less_html(idx){
    return "<a href=\"javascript:print_less('"+idx+"')\">--- [접기] ---</a>";
}
function print_less(idx){
    sobj = document.getElementById(content_show_array[idx]);
    pobj = document.getElementById(content_push_array[idx]);
    if (sobj) {
        sobj.style.height=content_height+'px';
        pobj.innerHTML = get_more_html(idx);
    }
}
function print_more(idx){
    sobj = document.getElementById(content_show_array[idx]);
    pobj = document.getElementById(content_push_array[idx]);
    if (sobj) {
        sobj.style.height='';
        pobj.innerHTML = get_less_html(idx);
    }
}
function init_more_less(){
    var i, max=content_idx_array.length;
    for (i=0;i<max;i++) {
        sobj = document.getElementById(content_show_array[content_idx_array[i]]);
        pobj = document.getElementById(content_push_array[content_idx_array[i]]);
        if (sobj && parseInt(sobj.offsetHeight)>content_height) {
            sobj.style.height=content_height+'px';
            pobj.innerHTML = get_more_html(content_idx_array[i]);
        }
    }
}
function onload_event(){
    init_more_less();
}
if (window.attachEvent) window.attachEvent('onload', onload_event);
else if (window.addEventListener) window.addEventListener('load', onload_event, false);
-->
</script>
<style>
div{margin:0; padding:0;}
body {font-family:Dotum, tahoma, sans-serif; font-size:12px;}
.my_title {font-weight:bold; margin-top:20px;}
.my_show {width:460px; overflow:hidden; word-wrap: break-word; word-break:break-all;}
.my_push {font-size:11px; margin-top:4px;}
a:link {color:blue; text-decoration:none; }
a:visited {color:blue; text-decoration:none;}
a:hover {color:blue; text-decoration:underline;}
</style>
</HEAD>
<BODY>
<div id="div_title_1001" class="my_title"><a href="http://hompy.info/517" target="_blank">위자드팩토리 위젯으로 블로그를 토핑해볼까?</a></div>
<div id="div_show_1001" class="my_show">
몇일전 위자드웍스에 의해 런칭한 위자드 팩토리에 있는 이쁜 위젯들로 블로그를 토핑해보면 어떨까요? 막 오픈한 서비스라서 선택할 수 있는 위젯의 폭이 아직은 좁은 편이나 좀더 쉽고 좀더 간편하게 사용할 수 있도록 구성한 유저 인터페이스와 아기자기한 디자인이 돋보입니다.<br>
<img src="http://hompy.info/attach/1/1182021495.jpg"><br>
유저가 직접 위젯을 제작할 수 있도록 이미 공개되었고 이번에 추가 버전업 된 오픈API도 제공하고 있으니 유저가 손수 만들어서 올릴 수 있습니다. 이렇게 만들어진 공개된 위젯은 위자드 팩토리에 의해 다양한 채널로 배포될 수 있습니다. 앞으로 퍼가고 싶은 다양하고 개성있는 위젯들이 얼마나 많이 진열될 것이냐에 따라 위젯공장의 역할을 할 수 있을지 여부가 결정될 것 같습니다. 위젯공장에 있는 눈에 띄는 시계,날씨,아기 위젯과 이번에 추천 블로그 선정으로 위젯공장에 등록된 제 블로그 RSS피드 위젯을 띄워봅니다.
</div>
<div id="div_push_1001" class="my_push"></div>

<div id="div_title_1001" class="my_title"><a href="http://hompy.info/516" target="_blank">뉴스 기사 소재, 블로깅 소스를 찾을 수 있는 뉴스와이어</a></div>
<div id="div_show_1002" class="my_show">
기자나 블로거들이 뉴스 기사 소재, 블로깅 소스를 찾을 수 있는 뉴스와이어라는 홈페이지가 있습니다. 2004년에 오픈한 이 서비스를 이용하는 기자분들이 많은 것으로 알고 있고 또한 기업이나 정부,기관,단체 입장에서 보면 홍보할 수 있는 채널로 활용될 수 있어 홍보나 마케팅에 관여하는 분들이 이 서비스를 많이 이용하고 있기도 합니다. 네이버 백과사전으로 검색해 보면 아래와 같은 소개가 나오는군요.
</div>
<div id="div_push_1002" class="my_push"></div>

<div id="div_title_1001" class="my_title"><a href="http://hompy.info/515" target="_blank">위젯 공유 서비스 위자드 팩토리 런칭 파티 후기</a></div>
<div id="div_show_1004" class="my_show">
저번에 위자드닷컴 추천 블로그로 선정되어 VIP(?) 초대장을 받고 어제 위젯 공유 서비스 위자드 팩토리 런칭 파티에 놀러 갔었습니다. 개인적으로 플래시 위젯 만드는 일이 취미이기도 하고 몇년 전 표철민 대표님과 메시지를 교환한 인연도 있었고 이번에 선정된 추천 블로거들도 만나볼려고 겸사겸사 퇴근하고 연세대 공학원에 마련된 행사장으로 직행했습니다. "1부, 위자드 팩토리 소개 및 시연회"에선 라면 이야기와 하루 2시간 자며 만들었다는 이야기가 인상적이었습니다. 위자드 웍스에 대한 자세한 회사 소개와 위자드 팩토리에 대한 간단한 소개를 들을 수 있었습니다. 1부는 식사 시간을 많이 늦출 수 없는 이유로 간소하게 진행된 것 같습니다. 위자드웍스가 어떤 일에 애정을 쏟고 있는 지 알 수 있게 되었고 앞으로 위젯 관련해서 어떤 일들이 벌어질 지 예측할 수 있는 시간이었습니다. "2부, 후원사들과 함께 하는 신나는 파티"에서는 깔끔한 식단의 뷔페식 식사 시간이 있었고 위젯을 내장한 흑맥주를 마시며 스텐딩 파티 형태의 참가자들 간 만남의 시간이 있었습니다. 예상 만큼 많은 블로거들과 인사를 나누지 못했고 위젯 관련해서 많은 정보를 교환하지 못해 아쉬운 부분이 있었습니다. 앞으로 또 다른 이름의 행사로 그 아쉬움을 채울 수 있는 기회가 만들어 질 것이라 기대하며 행사장을 빠져나왔습니다. 빠져나오는 중에 명찰을 반납하고 나니 "웹 패러다임을 바꾸는 위젯" 이라는 책이 포함된 선물을 한 보따리 주시더군요. 받은 선물을 들고 귀가 하느라 팔이 빠지는 줄 알았습니다.^^ 선물 감사했습니다.
위자드웍스 임직원 여러분들이 마련한 뜻 깊은 행사 즐거웠습니다. 앞으로 위자드웍스가 끊임없는 발전을 해서 위젯 업계의 부흥기를 이끌어갈 수 있기를 바라며 언제나 블로거들에게 사랑 받는 기업이 되주시길 바랍니다. 위하여!!!
</div>
<div id="div_push_1004" class="my_push"></div>

<div id="div_title_1001" class="my_title"><a href="http://hompy.info/514" target="_blank">전문직 직장인들이 함께하는 가을 축제가 있습니다.</a></div>
<div id="div_show_1005" class="my_show">
2008년 11월 1일에 전문직 직장인들과 함께하는 링크나우 가을 축제가 있습니다. 대학가요제 입상 경력이 있는 직장인 밴드와 가수들의 공연도 즐길 수 있고 노래와 춤 그리고 연주가 있는 직장인들의 장기자랑도 보며 즐거운 시간 가질 수 있게 될겁니다. 상품도 있다고 하니 장기자랑에 참여해보는 것도 좋겠지요. 더불어 부페 식사도 하고 맥주도 마시며 만남과 교류의 시간도 가질 수 있습니다. 행사명은 "링크나우 가을 페스티벌-음악과 만남의 밤"이고 최대 참석인원은 200명이군요. 행사 예약 페이지를 보시면 자세한 행사 내용과 어떤 분들이 참가하는 지 확인할 수 있습니다. 일정이 맞는 분들은 부담없이 참여해봐도 좋겠습니다.
</div>
<div id="div_push_1005" class="my_push"></div>

<div id="div_title_1001" class="my_title"><a href="http://hompy.info/513" target="_blank">플래시, 외부 파일 데이터 가져오기 통신 샘플 소스 #2</a></div>
<div id="div_show_1008" class="my_show">
플래시로 외부 파일 데이터를 가져오기 위한 웹서버와 통신하기 두번째 샘플 소스 코드입니다. 플래시 액션스크립트 초급자를 위해 학습용으로 부담없이 테스트할 수 있도록 만들었으므로 차근 차근 살펴 보시면 이해에 도움이 될 것이라 생각됩니다.<br>
<EMBED pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://www.hompydesign.com/club/blogchat.swf" width="190" height="200" type="application/x-shockwave-flash" quality="high" wmode="transparent"></EMBED><br>
아래 예제 처럼 LoadVars 객체를 이용해서 통신을 하는 것이 먼저 소개해드렸던 XML 객체를 이용하는 것 보다는 좀더 손쉽게 사용될 수 있습니다. 그러나 전달해야할 데이터가 복잡한 구조를 가질 경우 XML 객체를 이용하는 것 보다 혼란스러울 수 있으며 눈으로 손쉽게 데이터를 해석하기 어려울 수 있습니다. 아래 제공하는 샘플 소스 코드를 필요에 맞게 수정하고 개선해보면 어떻게 사용하는 것인지 이해하기 쉽습니다. 잘 익혀두었다가 사용자의 데이터를 등록하고 갱신하는 응용 프로그램 모양의 플래시를 만드는데 활용해보세요.
</div>
<div id="div_push_1008" class="my_push"></div>
</BODY>
</HTML>

웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
2008/10/15 23:57 2008/10/15 23:57

댓글을 달아 주세요

  1. 원숭 2010/04/30 14:20  댓글주소  수정/삭제  댓글쓰기

    땡쓰요~~~

  2. 네임펜 2010/02/09 02:56  댓글주소  수정/삭제  댓글쓰기

    님~ 감사해요.. 저에게 정말 필요했던 부분이었습니다. 이것 때문에 온종일 컴퓨터에 앉아서 고민했는데.. 바로 해결되었습니다. 정말 감사드려요.

  3. karin 2009/03/10 23:23  댓글주소  수정/삭제  댓글쓰기

    저도 가져갈게요~ 감사합니다 ^^

  4. dodo1028 2009/03/10 09:28  댓글주소  수정/삭제  댓글쓰기

    가져갈게요~ 좋은 정보 감사합니다^^

  5. dusskapark 2008/10/16 01:22  댓글주소  수정/삭제  댓글쓰기

    감사합니다....html에서 접기 갖다 붙이기는 하는데 지 좀 짜증났었는데 확풀리네요 감사합니다 열공할께요

얼마전에 "나만의 아날로그 플래시 시계를 직접 만들어 보자." 라는 글로 비교적 손쉽게 만들 수 있는 플래시 시계 제작법에 대해 소개했었습니다. 그러다 문득 자바스크립트로 아날로그 시계를 만들면 어떨까 라는 생각이 들어 검색엔진을 이용해 "javascript analog clock" 라는 키워드로 검색을 했더니 자바스크립트로 만든 아날로그 시계 CoolClock 을 소개하는 홈페이지가 있더군요. 웹문서에서 이미지를 그릴 수 있게 하는 캔버스를 이용해 구현되었으며 IE 에서는 캔버스가 지원이 되지 않는 관계로 ExplorerCanvas 를 이용해서 랜더링 했으나 퍼포먼스가 좀 떨어지는 감이 있습니다. 그리고 개성있는 나만의 시계를 만들 수 있게 스킨도 변경할 수 있도록 되어 있습니다. 관심 있는 분들은 구현되는 모습과 소스를 살펴보시면 자바스크립트 학습에 도움이 될 것 같습니다.
CoolClock 홈페이지가 간혹 열리지 않을 경우가 있습니다. 그래서 몇몇 스킨이 적용된 자바스크립트 아날로그 시계를 확인할 수 있는 별도의 페이지를 만들어놨으니 아래 링크로 작동되는 모습을 확인해 볼 수 있습니다.
http://www.hompydesign.com/javascript/clock/javascript_analog_clock.html

<!--[if IE]><script type="text/javascript" src="excanvas.js"></script><![endif]-->
<script type="text/javascript" src="coolclock.js"></script>
<script type="text/javascript" src="moreskins.js"></script>

<canvas id="s01" class="CoolClock:securephp"></canvas>
<canvas id="s02" class="CoolClock:Tes2"></canvas>
<canvas id="s03" class="CoolClock:Lev"></canvas>
<canvas id="s04" class="CoolClock:Sand"></canvas>
<br/>
<canvas id="s05" class="CoolClock:Sun"></canvas>
<canvas id="s06" class="CoolClock:Tor"></canvas>
<canvas id="s07" class="CoolClock:Cold"></canvas>
<canvas id="s08" class="CoolClock:Babosa"></canvas>

자바스크립트로 아날로그 시계 만드는 다른 방법에 대해 생각해보았는데 시계바늘의 움직임에 따른 투명 배경의 이미지를 만들어 해당 시간에 맞는 시계바늘 이미지만 서로 다른 레이어를 겹쳐 보여주는 형태로 구현을 해도 나쁘지 않을 것 같습니다. 다만 시계 바늘 이미지만 준비하면 시간의 변화에 맞는 회전되는 이미지를 자동으로 생성해주는 툴이 있어야 다양한 이미지의 시계를 손쉽게 제작할 수 있을 듯 싶습니다.
자바스크립트로 이미지를 다루는 것에 대해 이것 저것 살펴보다 보니 플래시 만큼 편한 툴이 없구나 라는 생각이 밀려듭니다.^^

 

[excanvas.js]
// Copyright 2006 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


// Known Issues:
//
// * Patterns are not implemented.
// * Radial gradient are not implemented. The VML version of these look very
//     different from the canvas one.
// * Clipping paths are not implemented.
// * Coordsize. The width and height attribute have higher priority than the
//     width and height style values which isn't correct.
// * Painting mode isn't implemented.
// * Canvas width/height should is using content-box by default. IE in
//     Quirks mode will draw the canvas using border-box. Either change your
//     doctype to HTML5
//     (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
//     or use Box Sizing Behavior from WebFX
//     (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
// * Optimize. There is always room for speed improvements.

// only add this code if we do not already have a canvas implementation
if (!window.CanvasRenderingContext2D) {

(function () {

    // alias some functions to make (compiled) code shorter
    var m = Math;
    var mr = m.round;
    var ms = m.sin;
    var mc = m.cos;

    // this is used for sub pixel precision
    var Z = 10;
    var Z2 = Z / 2;

    var G_vmlCanvasManager_ = {
        init: function (opt_doc) {
            var doc = opt_doc || document;
            if (/MSIE/.test(navigator.userAgent) && !window.opera) {
                var self = this;
                doc.attachEvent("onreadystatechange", function () {
                    self.init_(doc);
                });
            }
        },

        init_: function (doc) {
            if (doc.readyState == "complete") {
                // create xmlns
                if (!doc.namespaces["g_vml_"]) {
                    doc.namespaces.add("g_vml_", "urn:schemas-microsoft-com:vml");
                }

                // setup default css
                var ss = doc.createStyleSheet();
                ss.cssText = "canvas{display:inline-block;overflow:hidden;" +
                        // default size is 300x150 in Gecko and Opera
                        "text-align:left;width:300px;height:150px}" +
                        "g_vml_\\:*{behavior:url(#default#VML)}";

                // find all canvas elements
                var els = doc.getElementsByTagName("canvas");
                for (var i = 0; i < els.length; i++) {
                    if (!els[i].getContext) {
                        this.initElement(els[i]);
                    }
                }
            }
        },

        fixElement_: function (el) {
            // in IE before version 5.5 we would need to add HTML: to the tag name
            // but we do not care about IE before version 6
            var outerHTML = el.outerHTML;

            var newEl = el.ownerDocument.createElement(outerHTML);
            // if the tag is still open IE has created the children as siblings and
            // it has also created a tag with the name "/FOO"
            if (outerHTML.slice(-2) != "/>") {
                var tagName = "/" + el.tagName;
                var ns;
                // remove content
                while ((ns = el.nextSibling) && ns.tagName != tagName) {
                    ns.removeNode();
                }
                // remove the incorrect closing tag
                if (ns) {
                    ns.removeNode();
                }
            }
            el.parentNode.replaceChild(newEl, el);
            return newEl;
        },

        /**
        * Public initializes a canvas element so that it can be used as canvas
        * element from now on. This is called automatically before the page is
        * loaded but if you are creating elements using createElement you need to
        * make sure this is called on the element.
        * @param {HTMLElement} el The canvas element to initialize.
        * @return {HTMLElement} the element that was created.
        */
        initElement: function (el) {
            el = this.fixElement_(el);
            el.getContext = function () {
                if (this.context_) {
                    return this.context_;
                }
                return this.context_ = new CanvasRenderingContext2D_(this);
            };

            // do not use inline function because that will leak memory
            el.attachEvent('onpropertychange', onPropertyChange);
            el.attachEvent('onresize', onResize);

            var attrs = el.attributes;
            if (attrs.width && attrs.width.specified) {
                // TODO: use runtimeStyle and coordsize
                // el.getContext().setWidth_(attrs.width.nodeValue);
                el.style.width = attrs.width.nodeValue + "px";
            } else {
                el.width = el.clientWidth;
            }
            if (attrs.height && attrs.height.specified) {
                // TODO: use runtimeStyle and coordsize
                // el.getContext().setHeight_(attrs.height.nodeValue);
                el.style.height = attrs.height.nodeValue + "px";
            } else {
                el.height = el.clientHeight;
            }
            //el.getContext().setCoordsize_()
            return el;
        }
    };

    function onPropertyChange(e) {
        var el = e.srcElement;

        switch (e.propertyName) {
            case 'width':
                el.style.width = el.attributes.width.nodeValue + "px";
                el.getContext().clearRect();
                break;
            case 'height':
                el.style.height = el.attributes.height.nodeValue + "px";
                el.getContext().clearRect();
                break;
        }
    }

    function onResize(e) {
        var el = e.srcElement;
        if (el.firstChild) {
            el.firstChild.style.width =     el.clientWidth + 'px';
            el.firstChild.style.height = el.clientHeight + 'px';
        }
    }

    G_vmlCanvasManager_.init();

    // precompute "00" to "FF"
    var dec2hex = [];
    for (var i = 0; i < 16; i++) {
        for (var j = 0; j < 16; j++) {
            dec2hex[i * 16 + j] = i.toString(16) + j.toString(16);
        }
    }

    function createMatrixIdentity() {
        return [
            [1, 0, 0],
            [0, 1, 0],
            [0, 0, 1]
        ];
    }

    function matrixMultiply(m1, m2) {
        var result = createMatrixIdentity();

        for (var x = 0; x < 3; x++) {
            for (var y = 0; y < 3; y++) {
                var sum = 0;

                for (var z = 0; z < 3; z++) {
                    sum += m1[x][z] * m2[z][y];
                }

                result[x][y] = sum;
            }
        }
        return result;
    }

    function copyState(o1, o2) {
        o2.fillStyle         = o1.fillStyle;
        o2.lineCap             = o1.lineCap;
        o2.lineJoin             = o1.lineJoin;
        o2.lineWidth         = o1.lineWidth;
        o2.miterLimit         = o1.miterLimit;
        o2.shadowBlur         = o1.shadowBlur;
        o2.shadowColor     = o1.shadowColor;
        o2.shadowOffsetX = o1.shadowOffsetX;
        o2.shadowOffsetY = o1.shadowOffsetY;
        o2.strokeStyle     = o1.strokeStyle;
        o2.arcScaleX_         = o1.arcScaleX_;
        o2.arcScaleY_         = o1.arcScaleY_;
    }

    function processStyle(styleString) {
        var str, alpha = 1;

        styleString = String(styleString);
        if (styleString.substring(0, 3) == "rgb") {
            var start = styleString.indexOf("(", 3);
            var end = styleString.indexOf(")", start + 1);
            var guts = styleString.substring(start + 1, end).split(",");

            str = "#";
            for (var i = 0; i < 3; i++) {
                str += dec2hex[Number(guts[i])];
            }

            if ((guts.length == 4) && (styleString.substr(3, 1) == "a")) {
                alpha = guts[3];
            }
        } else {
            str = styleString;
        }

        return [str, alpha];
    }

    function processLineCap(lineCap) {
        switch (lineCap) {
            case "butt":
                return "flat";
            case "round":
                return "round";
            case "square":
            default:
                return "square";
        }
    }

    /**
    * This class implements CanvasRenderingContext2D interface as described by
    * the WHATWG.
    * @param {HTMLElement} surfaceElement The element that the 2D context should
    * be associated with
    */
    function CanvasRenderingContext2D_(surfaceElement) {
        this.m_ = createMatrixIdentity();

        this.mStack_ = [];
        this.aStack_ = [];
        this.currentPath_ = [];

        // Canvas context properties
        this.strokeStyle = "#000";
        this.fillStyle = "#000";

        this.lineWidth = 1;
        this.lineJoin = "miter";
        this.lineCap = "butt";
        this.miterLimit = Z * 1;
        this.globalAlpha = 1;
        this.canvas = surfaceElement;

        var el = surfaceElement.ownerDocument.createElement('div');
        el.style.width =     surfaceElement.clientWidth + 'px';
        el.style.height = surfaceElement.clientHeight + 'px';
        el.style.overflow = 'hidden';
        el.style.position = 'absolute';
        surfaceElement.appendChild(el);

        this.element_ = el;
        this.arcScaleX_ = 1;
        this.arcScaleY_ = 1;
    };

    var contextPrototype = CanvasRenderingContext2D_.prototype;
    contextPrototype.clearRect = function() {
        this.element_.innerHTML = "";
        this.currentPath_ = [];
    };

    contextPrototype.beginPath = function() {
        // TODO: Branch current matrix so that save/restore has no effect
        //             as per safari docs.

        this.currentPath_ = [];
    };

    contextPrototype.moveTo = function(aX, aY) {
        this.currentPath_.push({type: "moveTo", x: aX, y: aY});
        this.currentX_ = aX;
        this.currentY_ = aY;
    };

    contextPrototype.lineTo = function(aX, aY) {
        this.currentPath_.push({type: "lineTo", x: aX, y: aY});
        this.currentX_ = aX;
        this.currentY_ = aY;
    };

    contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
                                                                                        aCP2x, aCP2y,
                                                                                        aX, aY) {
        this.currentPath_.push({type: "bezierCurveTo",
                                                    cp1x: aCP1x,
                                                    cp1y: aCP1y,
                                                    cp2x: aCP2x,
                                                    cp2y: aCP2y,
                                                    x: aX,
                                                    y: aY});
        this.currentX_ = aX;
        this.currentY_ = aY;
    };

    contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {
        // the following is lifted almost directly from
        // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
        var cp1x = this.currentX_ + 2.0 / 3.0 * (aCPx - this.currentX_);
        var cp1y = this.currentY_ + 2.0 / 3.0 * (aCPy - this.currentY_);
        var cp2x = cp1x + (aX - this.currentX_) / 3.0;
        var cp2y = cp1y + (aY - this.currentY_) / 3.0;
        this.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, aX, aY);
    };

    contextPrototype.arc = function(aX, aY, aRadius,
                                                                    aStartAngle, aEndAngle, aClockwise) {
        aRadius *= Z;
        var arcType = aClockwise ? "at" : "wa";

        var xStart = aX + (mc(aStartAngle) * aRadius) - Z2;
        var yStart = aY + (ms(aStartAngle) * aRadius) - Z2;

        var xEnd = aX + (mc(aEndAngle) * aRadius) - Z2;
        var yEnd = aY + (ms(aEndAngle) * aRadius) - Z2;

        // IE won't render arches drawn counter clockwise if xStart == xEnd.
        if (xStart == xEnd && !aClockwise) {
            xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something
                                            // that can be represented in binary
        }

        this.currentPath_.push({type: arcType,
                                                    x: aX,
                                                    y: aY,
                                                    radius: aRadius,
                                                    xStart: xStart,
                                                    yStart: yStart,
                                                    xEnd: xEnd,
                                                    yEnd: yEnd});

    };

    contextPrototype.rect = function(aX, aY, aWidth, aHeight) {
        this.moveTo(aX, aY);
        this.lineTo(aX + aWidth, aY);
        this.lineTo(aX + aWidth, aY + aHeight);
        this.lineTo(aX, aY + aHeight);
        this.closePath();
    };

    contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
        // Will destroy any existing path (same as FF behaviour)
        this.beginPath();
        this.moveTo(aX, aY);
        this.lineTo(aX + aWidth, aY);
        this.lineTo(aX + aWidth, aY + aHeight);
        this.lineTo(aX, aY + aHeight);
        this.closePath();
        this.stroke();
    };

    contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
        // Will destroy any existing path (same as FF behaviour)
        this.beginPath();
        this.moveTo(aX, aY);
        this.lineTo(aX + aWidth, aY);
        this.lineTo(aX + aWidth, aY + aHeight);
        this.lineTo(aX, aY + aHeight);
        this.closePath();
        this.fill();
    };

    contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
        var gradient = new CanvasGradient_("gradient");
        return gradient;
    };

    contextPrototype.createRadialGradient = function(aX0, aY0,
                                                                                                    aR0, aX1,
                                                                                                    aY1, aR1) {
        var gradient = new CanvasGradient_("gradientradial");
        gradient.radius1_ = aR0;
        gradient.radius2_ = aR1;
        gradient.focus_.x = aX0;
        gradient.focus_.y = aY0;
        return gradient;
    };

    contextPrototype.drawImage = function (image, var_args) {
        var dx, dy, dw, dh, sx, sy, sw, sh;

        // to find the original width we overide the width and height
        var oldRuntimeWidth = image.runtimeStyle.width;
        var oldRuntimeHeight = image.runtimeStyle.height;
        image.runtimeStyle.width = 'auto';
        image.runtimeStyle.height = 'auto';

        // get the original size
        var w = image.width;
        var h = image.height;

        // and remove overides
        image.runtimeStyle.width = oldRuntimeWidth;
        image.runtimeStyle.height = oldRuntimeHeight;

        if (arguments.length == 3) {
            dx = arguments[1];
            dy = arguments[2];
            sx = sy = 0;
            sw = dw = w;
            sh = dh = h;
        } else if (arguments.length == 5) {
            dx = arguments[1];
            dy = arguments[2];
            dw = arguments[3];
            dh = arguments[4];
            sx = sy = 0;
            sw = w;
            sh = h;
        } else if (arguments.length == 9) {
            sx = arguments[1];
            sy = arguments[2];
            sw = arguments[3];
            sh = arguments[4];
            dx = arguments[5];
            dy = arguments[6];
            dw = arguments[7];
            dh = arguments[8];
        } else {
            throw "Invalid number of arguments";
        }

        var d = this.getCoords_(dx, dy);

        var w2 = sw / 2;
        var h2 = sh / 2;

        var vmlStr = [];

        var W = 10;
        var H = 10;

        // For some reason that I've now forgotten, using divs didn't work
        vmlStr.push(' <g_vml_:group',
                                ' coordsize="', Z * W, ',', Z * H, '"',
                                ' coordorigin="0,0"' ,
                                ' style="width:', W, ';height:', H, ';position:absolute;');

        // If filters are necessary (rotation exists), create them
        // filters are bog-slow, so only create them if abbsolutely necessary
        // The following check doesn't account for skews (which don't exist
        // in the canvas spec (yet) anyway.

        if (this.m_[0][0] != 1 || this.m_[0][1]) {
            var filter = [];

            // Note the 12/21 reversal
            filter.push("M11='", this.m_[0][0], "',",
                                    "M12='", this.m_[1][0], "',",
                                    "M21='", this.m_[0][1], "',",
                                    "M22='", this.m_[1][1], "',",
                                    "Dx='", mr(d.x / Z), "',",
                                    "Dy='", mr(d.y / Z), "'");

            // Bounding box calculation (need to minimize displayed area so that
            // filters don't waste time on unused pixels.
            var max = d;
            var c2 = this.getCoords_(dx + dw, dy);
            var c3 = this.getCoords_(dx, dy + dh);
            var c4 = this.getCoords_(dx + dw, dy + dh);

            max.x = Math.max(max.x, c2.x, c3.x, c4.x);
            max.y = Math.max(max.y, c2.y, c3.y, c4.y);

            vmlStr.push("padding:0 ", mr(max.x / Z), "px ", mr(max.y / Z),
                                    "px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",
                                    filter.join(""), ", sizingmethod='clip');")
        } else {
            vmlStr.push("top:", mr(d.y / Z), "px;left:", mr(d.x / Z), "px;")
        }

        vmlStr.push(' ">' ,
                                '<g_vml_:image src="', image.src, '"',
                                ' style="width:', Z * dw, ';',
                                ' height:', Z * dh, ';"',
                                ' cropleft="', sx / w, '"',
                                ' croptop="', sy / h, '"',
                                ' cropright="', (w - sx - sw) / w, '"',
                                ' cropbottom="', (h - sy - sh) / h, '"',
                                ' />',
                                '</g_vml_:group>');

        this.element_.insertAdjacentHTML("BeforeEnd",
                                                                        vmlStr.join(""));
    };

    contextPrototype.stroke = function(aFill) {
        var lineStr = [];
        var lineOpen = false;
        var a = processStyle(aFill ? this.fillStyle : this.strokeStyle);
        var color = a[0];
        var opacity = a[1] * this.globalAlpha;

        var W = 10;
        var H = 10;

        lineStr.push('<g_vml_:shape',
                                ' fillcolor="', color, '"',
                                ' filled="', Boolean(aFill), '"',
                                ' style="position:absolute;width:', W, ';height:', H, ';"',
                                ' coordorigin="0 0" coordsize="', Z * W, ' ', Z * H, '"',
                                ' stroked="', !aFill, '"',
                                ' strokeweight="', this.lineWidth, '"',
                                ' strokecolor="', color, '"',
                                ' path="');

        var newSeq = false;
        var min = {x: null, y: null};
        var max = {x: null, y: null};

        for (var i = 0; i < this.currentPath_.length; i++) {
            var p = this.currentPath_[i];

            if (p.type == "moveTo") {
                lineStr.push(" m ");
                var c = this.getCoords_(p.x, p.y);
                lineStr.push(mr(c.x), ",", mr(c.y));
            } else if (p.type == "lineTo") {
                lineStr.push(" l ");
                var c = this.getCoords_(p.x, p.y);
                lineStr.push(mr(c.x), ",", mr(c.y));
            } else if (p.type == "close") {
                lineStr.push(" x ");
            } else if (p.type == "bezierCurveTo") {
                lineStr.push(" c ");
                var c = this.getCoords_(p.x, p.y);
                var c1 = this.getCoords_(p.cp1x, p.cp1y);
                var c2 = this.getCoords_(p.cp2x, p.cp2y);
                lineStr.push(mr(c1.x), ",", mr(c1.y), ",",
                                        mr(c2.x), ",", mr(c2.y), ",",
                                        mr(c.x), ",", mr(c.y));
            } else if (p.type == "at" || p.type == "wa") {
                lineStr.push(" ", p.type, " ");
                var c     = this.getCoords_(p.x, p.y);
                var cStart = this.getCoords_(p.xStart, p.yStart);
                var cEnd = this.getCoords_(p.xEnd, p.yEnd);

                lineStr.push(mr(c.x - this.arcScaleX_ * p.radius), ",",
                                        mr(c.y - this.arcScaleY_ * p.radius), " ",
                                        mr(c.x + this.arcScaleX_ * p.radius), ",",
                                        mr(c.y + this.arcScaleY_ * p.radius), " ",
                                        mr(cStart.x), ",", mr(cStart.y), " ",
                                        mr(cEnd.x), ",", mr(cEnd.y));
            }


            // TODO: Following is broken for curves due to
            //             move to proper paths.

            // Figure out dimensions so we can do gradient fills
            // properly
            if(c) {
                if (min.x == null || c.x < min.x) {
                    min.x = c.x;
                }
                if (max.x == null || c.x > max.x) {
                    max.x = c.x;
                }
                if (min.y == null || c.y < min.y) {
                    min.y = c.y;
                }
                if (max.y == null || c.y > max.y) {
                    max.y = c.y;
                }
            }
        }
        lineStr.push(' ">');

        if (typeof this.fillStyle == "object") {
            var focus = {x: "50%", y: "50%"};
            var width = (max.x - min.x);
            var height = (max.y - min.y);
            var dimension = (width > height) ? width : height;

            focus.x = mr((this.fillStyle.focus_.x / width) * 100 + 50) + "%";
            focus.y = mr((this.fillStyle.focus_.y / height) * 100 + 50) + "%";

            var colors = [];

            // inside radius (%)
            if (this.fillStyle.type_ == "gradientradial") {
                var inside = (this.fillStyle.radius1_ / dimension * 100);

                // percentage that outside radius exceeds inside radius
                var expansion = (this.fillStyle.radius2_ / dimension * 100) - inside;
            } else {
                var inside = 0;
                var expansion = 100;
            }

            var insidecolor = {offset: null, color: null};
            var outsidecolor = {offset: null, color: null};

            // We need to sort 'colors' by percentage, from 0 > 100 otherwise ie
            // won't interpret it correctly
            this.fillStyle.colors_.sort(function (cs1, cs2) {
                return cs1.offset - cs2.offset;
            });

            for (var i = 0; i < this.fillStyle.colors_.length; i++) {
                var fs = this.fillStyle.colors_[i];

                colors.push( (fs.offset * expansion) + inside, "% ", fs.color, ",");

                if (fs.offset > insidecolor.offset || insidecolor.offset == null) {
                    insidecolor.offset = fs.offset;
                    insidecolor.color = fs.color;
                }

                if (fs.offset < outsidecolor.offset || outsidecolor.offset == null) {
                    outsidecolor.offset = fs.offset;
                    outsidecolor.color = fs.color;
                }
            }
            colors.pop();

            lineStr.push('<g_vml_:fill',
                                    ' color="', outsidecolor.color, '"',
                                    ' color2="', insidecolor.color, '"',
                                    ' type="', this.fillStyle.type_, '"',
                                    ' focusposition="', focus.x, ', ', focus.y, '"',
                                    ' colors="', colors.join(""), '"',
                                    ' opacity="', opacity, '" />');
        } else if (aFill) {
            lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity, '" />');
        } else {
            lineStr.push(
                '<g_vml_:stroke',
                ' opacity="', opacity,'"',
                ' joinstyle="', this.lineJoin, '"',
                ' miterlimit="', this.miterLimit, '"',
                ' endcap="', processLineCap(this.lineCap) ,'"',
                ' weight="', this.lineWidth, 'px"',
                ' color="', color,'" />'
            );
        }

        lineStr.push("</g_vml_:shape>");

        this.element_.insertAdjacentHTML("beforeEnd", lineStr.join(""));

        this.currentPath_ = [];
    };

    contextPrototype.fill = function() {
        this.stroke(true);
    }

    contextPrototype.closePath = function() {
        this.currentPath_.push({type: "close"});
    };

    /**
    * @private
    */
    contextPrototype.getCoords_ = function(aX, aY) {
        return {
            x: Z * (aX * this.m_[0][0] + aY * this.m_[1][0] + this.m_[2][0]) - Z2,
            y: Z * (aX * this.m_[0][1] + aY * this.m_[1][1] + this.m_[2][1]) - Z2
        }
    };

    contextPrototype.save = function() {
        var o = {};
        copyState(this, o);
        this.aStack_.push(o);
        this.mStack_.push(this.m_);
        this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);
    };

    contextPrototype.restore = function() {
        copyState(this.aStack_.pop(), this);
        this.m_ = this.mStack_.pop();
    };

    contextPrototype.translate = function(aX, aY) {
        var m1 = [
            [1,     0,     0],
            [0,     1,     0],
            [aX, aY, 1]
        ];

        this.m_ = matrixMultiply(m1, this.m_);
    };

    contextPrototype.rotate = function(aRot) {
        var c = mc(aRot);
        var s = ms(aRot);

        var m1 = [
            [c,     s, 0],
            [-s, c, 0],
            [0,     0, 1]
        ];

        this.m_ = matrixMultiply(m1, this.m_);
    };

    contextPrototype.scale = function(aX, aY) {
        this.arcScaleX_ *= aX;
        this.arcScaleY_ *= aY;
        var m1 = [
            [aX, 0,     0],
            [0,     aY, 0],
            [0,     0,     1]
        ];

        this.m_ = matrixMultiply(m1, this.m_);
    };

    /******** STUBS ********/
    contextPrototype.clip = function() {
        // TODO: Implement
    };

    contextPrototype.arcTo = function() {
        // TODO: Implement
    };

    contextPrototype.createPattern = function() {
        return new CanvasPattern_;
    };

    // Gradient / Pattern Stubs
    function CanvasGradient_(aType) {
        this.type_ = aType;
        this.radius1_ = 0;
        this.radius2_ = 0;
        this.colors_ = [];
        this.focus_ = {x: 0, y: 0};
    }

    CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {
        aColor = processStyle(aColor);
        this.colors_.push({offset: 1-aOffset, color: aColor});
    };

    function CanvasPattern_() {}

    // set up externs
    G_vmlCanvasManager = G_vmlCanvasManager_;
    CanvasRenderingContext2D = CanvasRenderingContext2D_;
    CanvasGradient = CanvasGradient_;
    CanvasPattern = CanvasPattern_;

})();

} // if

[coolclock.js]
/*
CoolClock by Simon Baird (simon dot baird at gmail dot com)
Version 1.0.6 (08-Jul-2008)
See http://simonbaird.com/coolclock/

Copyright (c) Simon Baird 2006-2008

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.

Neither the name of the Simon Baird nor the names of other contributors may be
used to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
*/

window.CoolClock = function(canvasId,displayRadius,skinId,showSecondHand,gmtOffset) {
    return this.init(canvasId,displayRadius,skinId,showSecondHand,gmtOffset);
}

CoolClock.findAndCreateClocks = function() {
    var canvases = document.getElementsByTagName("canvas");
    for (var i=0;i<canvases.length;i++) {
        var fields = canvases[i].className.split(" ")[0].split(":");
        if (fields[0] == "CoolClock") {
            new CoolClock(canvases[i].id,fields[2],fields[1],fields[3]!="noSeconds",fields[4]);
        }
    }
}

// borrowed from behaviour.js
// actually doesn't work right unless it's at the end of html document
// hence can't have a body onload
// this is a bug. FIXME
// maybe have a setTimeout hack??
CoolClock.addLoadEvent = function(func){
    var oldonload = window.onload;
    if (typeof window.onload != 'function')
        window.onload = func;
    else
        window.onload = function() {
            oldonload();
            func();
        }
}

CoolClock.config = {
    clockTracker: {},
    tickDelay: 1000,
    longTickDelay: 15000,
    defaultRadius: 85,
    renderRadius: 100,
    defaultSkin: "swissRail",
    skins:     {
        // more skins in moreskins.js
        // try making your own...

        swissRail: {
            outerBorder: { lineWidth: 1, radius:95, color: "black", alpha: 1 },
            smallIndicator: { lineWidth: 2, startAt: 89, endAt: 93, color: "black", alpha: 1 },
            largeIndicator: { lineWidth: 4, startAt: 80, endAt: 93, color: "black", alpha: 1 },
            hourHand: { lineWidth: 8, startAt: -15, endAt: 50, color: "black", alpha: 1 },
            minuteHand: { lineWidth: 7, startAt: -15, endAt: 75, color: "black", alpha: 1 },
            secondHand: { lineWidth: 1, startAt: -20, endAt: 85, color: "red", alpha: 1 },
            secondDecoration: { lineWidth: 1, startAt: 70, radius: 4, fillColor: "red", color: "red", alpha: 1 }
        },
        chunkySwiss: {
            outerBorder: { lineWidth: 4, radius:97, color: "black", alpha: 1 },
            smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "black", alpha: 1 },
            largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "black", alpha: 1 },
            hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "black", alpha: 1 },
            minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "black", alpha: 1 },
            secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "red", alpha: 1 },
            secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "red", color: "red", alpha: 1 }
        },
        chunkySwissOnBlack: {
            outerBorder: { lineWidth: 4, radius:97, color: "white", alpha: 1 },
            smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "white", alpha: 1 },
            largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "white", alpha: 1 },
            hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "white", alpha: 1 },
            minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "white", alpha: 1 },
            secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "red", alpha: 1 },
            secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "red", color: "red", alpha: 1 }
        }

    }
};

CoolClock.prototype = {
    init: function(canvasId,displayRadius,skinId,showSecondHand,gmtOffset) {
        this.canvasId = canvasId;
        this.displayRadius = displayRadius || CoolClock.config.defaultRadius;
        this.skinId = skinId || CoolClock.config.defaultSkin;
        this.showSecondHand = typeof showSecondHand == "boolean" ? showSecondHand : true;
        this.tickDelay = CoolClock.config[ this.showSecondHand ? "tickDelay" : "longTickDelay"];

        this.canvas = document.getElementById(canvasId);

        this.canvas.setAttribute("width",this.displayRadius*2);
        this.canvas.setAttribute("height",this.displayRadius*2);

        this.canvas.style.width = this.displayRadius*2 + "px";
        this.canvas.style.height = this.displayRadius*2 + "px";

        this.renderRadius = CoolClock.config.renderRadius;

        this.scale = this.displayRadius / this.renderRadius;
        this.ctx = this.canvas.getContext("2d");
        this.ctx.scale(this.scale,this.scale);

        this.gmtOffset = gmtOffset != null ? parseFloat(gmtOffset) : gmtOffset;

        CoolClock.config.clockTracker[canvasId] = this;
        this.tick();
        return this;
    },

    fullCircle: function(skin) {
        this.fullCircleAt(this.renderRadius,this.renderRadius,skin);
    },

    fullCircleAt: function(x,y,skin) {
        with (this.ctx) {
            save();
            globalAlpha = skin.alpha;
            lineWidth = skin.lineWidth;
            if (!document.all)
                beginPath();
            if (document.all)
                // excanvas doesn't scale line width so we will do it here
                lineWidth = lineWidth * this.scale;
            arc(x, y, skin.radius, 0, 2*Math.PI, false);
            if (document.all)
                // excanvas doesn't close the circle so let's color in the gap
                arc(x, y, skin.radius, -0.1, 0.1, false);
            if (skin.fillColor) {
                fillStyle = skin.fillColor
                fill();
            }
            else {
                // XXX why not stroke and fill
                strokeStyle = skin.color;
                stroke();
            }
            restore();
        }
    },

    radialLineAtAngle: function(angleFraction,skin) {
        with (this.ctx) {
            save();
            translate(this.renderRadius,this.renderRadius);
            rotate(Math.PI * (2 * angleFraction - 0.5));
            globalAlpha = skin.alpha;
            strokeStyle = skin.color;
            lineWidth = skin.lineWidth;
            if (document.all)
                // excanvas doesn't scale line width so we will do it here
                lineWidth = lineWidth * this.scale;
            if (skin.radius) {
                this.fullCircleAt(skin.startAt,0,skin)
            }
            else {
                beginPath();
                moveTo(skin.startAt,0)
                lineTo(skin.endAt,0);
                stroke();
            }
            restore();
        }
    },

    render: function(hour,min,sec) {
        var skin = CoolClock.config.skins[this.skinId];
        this.ctx.clearRect(0,0,this.renderRadius*2,this.renderRadius*2);

        this.fullCircle(skin.outerBorder);

        for (var i=0;i<60;i++)
            this.radialLineAtAngle(i/60,skin[ i%5 ? "smallIndicator" : "largeIndicator"]);
               
        this.radialLineAtAngle((hour+min/60)/12,skin.hourHand);
        this.radialLineAtAngle((min+sec/60)/60,skin.minuteHand);
        if (this.showSecondHand) {
            this.radialLineAtAngle(sec/60,skin.secondHand);
            if (!document.all)
                // decoration doesn't render right in IE so lets turn it off
                this.radialLineAtAngle(sec/60,skin.secondDecoration);
        }
    },


    nextTick: function() {
        setTimeout("CoolClock.config.clockTracker['"+this.canvasId+"'].tick()",this.tickDelay);
    },

    stillHere: function() {
        return document.getElementById(this.canvasId) != null;
    },

    refreshDisplay: function() {
        var now = new Date();
        if (this.gmtOffset != null) {
            // use GMT + gmtOffset
            var offsetNow = new Date(now.valueOf() + (this.gmtOffset * 1000 * 60 * 60));
            this.render(offsetNow.getUTCHours(),offsetNow.getUTCMinutes(),offsetNow.getUTCSeconds());
        }
        else {
            // use local time
            this.render(now.getHours(),now.getMinutes(),now.getSeconds());
        }
    },

    tick: function() {
        if (this.stillHere()) {
            this.refreshDisplay()
            this.nextTick();
        }
    }
}

CoolClock.addLoadEvent(CoolClock.findAndCreateClocks);

[moreskins.js]
CoolClock.config.skins = {

    swissRail: {
        outerBorder: { lineWidth: 1, radius:95, color: "black", alpha: 1 },
        smallIndicator: { lineWidth: 2, startAt: 89, endAt: 93, color: "black", alpha: 1 },
        largeIndicator: { lineWidth: 4, startAt: 80, endAt: 93, color: "black", alpha: 1 },
        hourHand: { lineWidth: 8, startAt: -15, endAt: 50, color: "black", alpha: 1 },
        minuteHand: { lineWidth: 7, startAt: -15, endAt: 75, color: "black", alpha: 1 },
        secondHand: { lineWidth: 1, startAt: -20, endAt: 85, color: "red", alpha: 1 },
        secondDecoration: { lineWidth: 1, startAt: 70, radius: 4, fillColor: "red", color: "red", alpha: 1 }
    },

    chunkySwiss: {
        outerBorder: { lineWidth: 4, radius:97, color: "black", alpha: 1 },
        smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "black", alpha: 1 },
        largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "black", alpha: 1 },
        hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "black", alpha: 1 },
        minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "black", alpha: 1 },
        secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "red", alpha: 1 },
        secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "red", color: "red", alpha: 1 }
    },

    chunkySwissOnBlack: {
        outerBorder: { lineWidth: 4, radius:97, color: "white", alpha: 1 },
        smallIndicator: { lineWidth: 4, startAt: 89, endAt: 93, color: "white", alpha: 1 },
        largeIndicator: { lineWidth: 8, startAt: 80, endAt: 93, color: "white", alpha: 1 },
        hourHand: { lineWidth: 12, startAt: -15, endAt: 60, color: "white", alpha: 1 },
        minuteHand: { lineWidth: 10, startAt: -15, endAt: 85, color: "white", alpha: 1 },
        secondHand: { lineWidth: 4, startAt: -20, endAt: 85, color: "red", alpha: 1 },
        secondDecoration: { lineWidth: 2, startAt: 70, radius: 8, fillColor: "red", color: "red", alpha: 1 }
    },

    fancy: {
        outerBorder: { lineWidth: 5, radius:95, color: "green", alpha: 0.7 },
        smallIndicator: { lineWidth: 1, startAt: 80, endAt: 93, color: "black", alpha: 0.4 },
        largeIndicator: { lineWidth: 1, startAt: 30, endAt: 93, color: "black", alpha: 0.5 },
        hourHand: { lineWidth: 8, startAt: -15, endAt: 50, color: "blue", alpha: 0.7 },
        minuteHand: { lineWidth: 7, startAt: -15, endAt: 92, color: "red", alpha: 0.7 },
        secondHand: { lineWidth: 10, startAt: 80, endAt: 85, color: "blue", alpha: 0.3 },
        secondDecoration: { lineWidth: 1, startAt: 30, radius: 50, fillColor: "blue", color: "red", alpha: 0.15 }
    },

    machine: {
        outerBorder: { lineWidth: 60, radius:55, color: "#dd6655", alpha: 1 },
        smallIndicator: { lineWidth: 4, startAt: 80, endAt: 95, color: "white", alpha: 1 },
        largeIndicator: { lineWidth: 14, startAt: 77, endAt: 92, color: "#dd6655", alpha: 1 },
        hourHand: { lineWidth: 18, startAt: -15, endAt: 40, color: "white", alpha: 1 },
        minuteHand: { lineWidth: 14, startAt: 24, endAt: 100, color: "#771100", alpha: 0.5 },
        secondHand: { lineWidth: 3, startAt: 22, endAt: 83, color: "green", alpha: 0 },
        secondDecoration: { lineWidth: 1, startAt: 52, radius: 26, fillColor: "#ffcccc", color: "red", alpha: 0.5 }
    },

    // these three created by bonstio from http://bonstio.net
    classic/*was gIG*/: {
        outerBorder: { lineWidth: 185, radius:1, color: "#E5ECF9", alpha: 1 },
        smallIndicator: { lineWidth: 2, startAt: 89, endAt: 94, color: "#3366CC", alpha: 1 },
        largeIndicator: { lineWidth: 4, startAt: 83, endAt: 94, color: "#3366CC", alpha: 1 },
        hourHand: { lineWidth: 5, startAt: 0, endAt: 60, color: "black", alpha: 1 },
        minuteHand: { lineWidth: 4, startAt: 0, endAt: 80, color: "black", alpha: 1 },
        secondHand: { lineWidth: 1, startAt: -20, endAt: 85, color: "red", alpha: .85 },
        secondDecoration: { lineWidth: 3, startAt: 0, radius: 2, fillColor: "black", color: "black", alpha: 1 }
    },

    modern/*was gIG2*/: {
        outerBorder: { lineWidth: 185, radius:1, color: "#E5ECF9", alpha: 1 },
        smallIndicator: { lineWidth: 5, startAt: 88, endAt: 94, color: "#3366CC", alpha: 1 },
        largeIndicator: { lineWidth: 5, startAt: 88, endAt: 94, color: "#3366CC", alpha: 1 },
        hourHand: { lineWidth: 8, startAt: 0, endAt: 60, color: "black", alpha: 1 },
        minuteHand: { lineWidth: 8, startAt: 0, endAt: 80, color: "black", alpha: 1 },
        secondHand: { lineWidth: 5, startAt: 80, endAt: 85, color: "red", alpha: .85 },
        secondDecoration: { lineWidth: 3, startAt: 0, radius: 4, fillColor: "black", color: "black", alpha: 1 }
    },

    simple/*was gIG3*/: {
        outerBorder: { lineWidth: 185, radius:1, color: "#E5ECF9", alpha: 1 },
        smallIndicator: { lineWidth: 10, startAt: 90, endAt: 94, color: "#3366CC", alpha: 1 },
        largeIndicator: { lineWidth: 10, startAt: 90, endAt: 94, color: "#3366CC", alpha: 1 },
        hourHand: { lineWidth: 8, startAt: 0, endAt: 60, color: "black", alpha: 1 },
        minuteHand: { lineWidth: 8, startAt: 0, endAt: 80, color: "black", alpha: 1 },
        secondHand: { lineWidth: 5, startAt: 80, endAt: 85, color: "red", alpha: .85 },
        secondDecoration: { lineWidth: 3, startAt: 0, radius: 4, fillColor: "black", color: "black", alpha: 1 }
    },

    // these two by securephp
    securephp: {
        outerBorder: { lineWidth: 100, radius:0.45, color: "#669900", alpha: 0.3 },
        smallIndicator: { lineWidth: 2, startAt: 80, endAt:90 , color: "green", alpha: 1 },
        largeIndicator: { lineWidth: 8.5, startAt: 20, endAt:40 , color: "green", alpha: 0.4 },
        hourHand: { lineWidth: 3, startAt: 0, endAt: 60, color: "black", alpha: 1 },
        minuteHand: { lineWidth: 2, startAt: 0, endAt: 75, color: "black", alpha: 1 },
        secondHand: { lineWidth: 1, startAt: -10, endAt: 80, color: "blue", alpha: 0.8 },
        secondDecoration: { lineWidth: 1, startAt: 70, radius: 4, fillColor: "blue", color: "red", alpha: 1 }
    },

    Tes2: {
        outerBorder: { lineWidth: 4, radius:95, color: "black", alpha: 0.5 },
        smallIndicator: { lineWidth: 1, startAt: 10, endAt:50 , color: "#66CCFF", alpha: 1 },
        largeIndicator: { lineWidth: 8.5, startAt: 60, endAt: 70, color: "#6699FF", alpha: 1 },
        hourHand: { lineWidth: 5, startAt: -15, endAt: 60, color: "black", alpha: 0.7 },
        minuteHand: { lineWidth: 3, startAt: -25, endAt: 75, color: "black", alpha: 0.7 },
        secondHand: { lineWidth: 1.5, startAt: -20, endAt: 88, color: "red", alpha: 1 },
        secondDecoration: { lineWidth: 1, startAt: 20, radius: 4, fillColor: "blue", color: "red", alpha: 1 }
    },


    Lev: {
    outerBorder: { lineWidth:10, radius:95, color: "#CCFF33", alpha: 0.65 },
    smallIndicator: { lineWidth: 5, startAt: 84, endAt: 90, color: "#996600", alpha: 1 },
    largeIndicator: { lineWidth: 40, startAt: 25, endAt: 95, color: "#336600", alpha: 0.55 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 0.9 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 80, color: "black", alpha: 0.85 },
    secondHand: { lineWidth: 1, startAt: 0, endAt: 85, color: "black", alpha: 1 },
    secondDecoration: { lineWidth: 2, startAt: 5, radius: 10, fillColor: "black", color: "black", alpha: 1 }
    },

    Sand: {
    outerBorder: { lineWidth:1, radius:70, color: "black", alpha: 0.5 },
    smallIndicator: { lineWidth: 3, startAt: 50, endAt: 70, color: "#0066FF", alpha: 0.5 },
    largeIndicator: { lineWidth: 200, startAt: 80, endAt: 95, color: "#996600", alpha: 0.75 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 0.9 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 80, color: "black", alpha: 0.85 },
    secondHand: { lineWidth: 1, startAt: 0, endAt: 85, color: "black", alpha: 1 },
    secondDecoration: { lineWidth: 2, startAt: 5, radius: 10, fillColor: "black", color: "black", alpha: 1 }
    },

    Sun: {
    outerBorder: { lineWidth:100, radius:140, color: "#99FFFF", alpha: 0.2 },
    smallIndicator: { lineWidth: 300, startAt: 50, endAt: 70, color: "black", alpha: 0.1 },
    largeIndicator: { lineWidth: 5, startAt: 80, endAt: 95, color: "black", alpha: 0.65 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 0.9 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 80, color: "black", alpha: 0.85 },
    secondHand: { lineWidth: 1, startAt: 0, endAt: 90, color: "black", alpha: 1 },
    secondDecoration: { lineWidth: 2, startAt: 5, radius: 10, fillColor: "black", color: "black", alpha: 1 }
    },

    Tor: {
    outerBorder: { lineWidth:10, radius:88, color: "#996600", alpha: 0.9 },
    smallIndicator: { lineWidth: 6, startAt: -10, endAt: 73, color: "green", alpha: 0.3 },
    largeIndicator: { lineWidth: 6, startAt: 73, endAt: 100, color: "black", alpha: 0.65 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 1 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 80, color: "black", alpha: 1 },
    secondHand: { lineWidth: 1, startAt: -73, endAt: 73, color: "black", alpha: 0.8 },
    secondDecoration: { lineWidth: 2, startAt: 5, radius: 10, fillColor: "black", color: "black", alpha: 1 }
    },

    Cold: {
    outerBorder: { lineWidth:15, radius:90, color: "black", alpha: 0.3 },
    smallIndicator: { lineWidth: 15, startAt: -10, endAt: 95, color: "blue", alpha: 0.1 },
    largeIndicator: { lineWidth: 3, startAt: 80, endAt: 95, color: "blue", alpha: 0.65 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 1 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 80, color: "black", alpha: 1 },
    secondHand: { lineWidth: 1, startAt: 0, endAt: 85, color: "black", alpha: 0.8 },
    secondDecoration: { lineWidth: 5, startAt: 30, radius: 10, fillColor: "black", color: "black", alpha: 1 }
    },

    Babosa: {
    outerBorder: { lineWidth: 100, radius:25, color: "blue", alpha: 0.25 },
    smallIndicator: { lineWidth: 3, startAt: 90, endAt: 95, color: "#3366CC", alpha: 1 },
    largeIndicator: { lineWidth: 4, startAt: 75, endAt: 95, color: "#3366CC", alpha: 1 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 60, color: "black", alpha: 1 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 85, color: "black", alpha: 1 },
    secondHand: { lineWidth: 12, startAt: 75, endAt: 90, color: "red", alpha: 0.8 },
    secondDecoration: { lineWidth: 3, startAt: 0, radius: 4, fillColor: "black", color: "black", alpha: 1 }
    },

    Tumb: {
    outerBorder: { lineWidth:105, radius:5, color: "green", alpha: 0.4 },
    smallIndicator: { lineWidth: 1, startAt: 93, endAt: 98, color: "green", alpha: 1 },
    largeIndicator: { lineWidth: 50, startAt: 0, endAt: 89, color: "red", alpha: 0.14 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 1 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 80, color: "black", alpha: 1 },
    secondHand: { lineWidth: 1, startAt: 0, endAt: 85, color: "black", alpha: 0.8 },
    secondDecoration: { lineWidth: 5, startAt: 50, radius: 90, fillColor: "black", color: "black", alpha: 0.05 }
    },

    Stone: {
    outerBorder: { lineWidth:15, radius:80, color: "#339933", alpha: 0.5 },
    smallIndicator: { lineWidth: 2, startAt: 70, endAt: 90, color: "#FF3300", alpha: 0.7 },
    largeIndicator: { lineWidth: 15, startAt: 0, endAt: 29, color: "#FF6600", alpha: 0.3 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 1 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 75, color: "black", alpha: 1 },
    secondHand: { lineWidth: 1, startAt: 0, endAt: 85, color: "black", alpha: 0.8 },
    secondDecoration: { lineWidth: 5, startAt: 50, radius: 90, fillColor: "black", color: "black", alpha: 0.05 }
    },

    Disc: {
    outerBorder: { lineWidth:105, radius:1, color: "#666600", alpha: 0.2 },
    smallIndicator: { lineWidth: 1, startAt: 58, endAt: 95, color: "#669900", alpha: 0.8 },
    largeIndicator: { lineWidth: 6, startAt: 25, endAt: 35, color: "#666600", alpha: 1 },
    hourHand: { lineWidth: 4, startAt: 0, endAt: 65, color: "black", alpha: 1 },
    minuteHand: { lineWidth: 3, startAt: 0, endAt: 75, color: "black", alpha: 1 },
    secondHand: { lineWidth: 1, startAt: -75, endAt: 75, color: "#99CC00", alpha: 0.8 },
    secondDecoration: { lineWidth: 5, startAt: 50, radius: 90, fillColor: "#00FF00", color: "green", alpha: 0.05 }
    }

};


웹프로그래머의 홈페이지 정보 블로그 http://hompy.info
2008/09/30 05:17 2008/09/30 05:17

댓글을 달아 주세요

  1. 모꼬모지 2009/10/12 11:15  댓글주소  수정/삭제  댓글쓰기

    아무리 해도 님이 수정하신건.. 안되는 군요..-_-)a
    물론 원출처 것은 잘됩니다.
    환경 xp 익스 6.x

자바스크립트 createElement, insertBefore, replaceChild, appendChild 다루기 샘플
<html>
<div id = "a">
<div id=a1>&lt;div&gt;a1&lt;/div&gt;</div>
<div id=a2>&lt;div&gt;a2&lt;/div&gt;</div>
<div id=a3>&lt;div&gt;a3&lt;/div&gt;</div>
<div id=a4>&lt;div&gt;a4&lt;/div&gt;</div>
<div id=a5>&lt;div&gt;a5&lt;/div&gt;</div>
</div>
<script>
newobj = document.createElement( "div");
newobj.innerHTML = '&lt;div&gt;b&lt;/div&gt;';
newobj2 = document.createElement( "div");
newobj2.innerHTML = '&lt;div&gt;c&lt;/div&gt;';
divobjs = document.getElementsByTagName( "div");
//divobjs[2].parentNode.appendChild( newobj);

document.getElementById('a').insertBefore(document.getElementById('a3'), document.getElementById('a2'));
document.getElementById('a').replaceChild(newobj, document.getElementById('a3'));
document.getElementById('a').appendChild(newobj2);

//alert(document.getElementById('a').innerHTML);
</script>
</html>
<div>a1</div>
<div>a2</div>
<div>a3</div>
<div>a4</div>
<div>a5</div>
2008/03/26 23:58 2008/03/26 23:58

댓글을 달아 주세요

  1. 귀차니즘 2011/04/04 17:07  댓글주소  수정/삭제  댓글쓰기

    찾던 정보를 발견하여 유용하게 적용하였습니다.^^
    트레픽으로 보내려하는데 자꾸 전송이 안되서 코멘트로 달아놈니다.
    감사합니다....수고하세요!

움직이는 막대 그래프 만들기 자바스크립트 소스입니다. 개별 막대가 점진적으로 목표 크기에 다가가는 모션이 적용되었으며 막대의 현재 크기와 목표 크기 사이의 간격을 기준으로 일정 비율(1/8)로 더해주는 방식입니다. bar_init 함수 내 80 이라는 숫자와 bar_timer 함수 내 8 이라는 숫자를 수정하여 개인 취향에 맞게 모션에 변화를 줄 수 있습니다. 해당 막대의 목표 크기는 img 태그의 barwidth 와 barheight 에 의해서 결정됩니다. 웹페이지에서 오브젝트의 동적인 움직임을 구현할 때 setInterval 이라는 함수가 요긴하게 사용됩니다. 비슷한 방식으로 플래시로 막대 그래프를 구현한다면 setInterval 함수나 onEnterFrame 이라는 이벤트를 사용할 수 있습니다. 그런데 Tween 객체를 쓰면 보다 손쉽게 모션을 구현할 수 있지요. 막대그래프를 그리는 방법에 대한 정답은 당신에게 있습니다. 자신의 개성에 맞게 수정하고 보완한다면 그 정답을 찾을 수 있을겁니다.  




<HTML>
<HEAD>
<TITLE>막대그래프</TITLE>
<script>
var bar_obj = [], ybar_obj = [], bar_obj_max = 14, ybar_obj_max = 21;
function bar_timer(pos){
	var obj = bar_obj[pos], more;
	if ((obj.barwidth - obj.width)>1){
		more = (obj.barwidth - obj.width) / 8;
		obj.width += more;
	} else {
		clearInterval(obj.timer_id);
		obj.width = obj.barwidth;
	}
}
function ybar_timer(pos){
	var obj = ybar_obj[pos], more;
	if ((obj.barheight - obj.height)>1){
		more = (obj.barheight - obj.height) / 8;
		obj.height += more;
	} else {
		clearInterval(obj.timer_id);
		obj.height = obj.height;
	}
}
function bar_init(){
	for (i=0;i<bar_obj_max;i++){
		bar_obj[i] = document.getElementById('bar_img_'+i);
		bar_obj[i].timer_id = setInterval('bar_timer('+i+')',30);
	}
	for (i=0;i<ybar_obj_max;i++){
		ybar_obj[i] = document.getElementById('ybar_img_'+i);
		ybar_obj[i].timer_id = setInterval('ybar_timer('+i+')',30);
	}
}
</script>
<style>
.box_id {width:360px}
.box_id td {background-color:#111111;}
.ybox_id {height:200px;}
.ybox_id td {background-color:#111111; text-align:center; vertical-align:bottom}
</style>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onload="javscript:bar_init();">
<table cellspacing=2 cellpadding=2 border=0 width=500 class=box_id>
<tr><td><img id='bar_img_0' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_0.gif" width="1" height="12" barwidth=280></td></tr>
<tr><td><img id='bar_img_1' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_1.gif" width="1" height="12" barwidth=250></td></tr>
<tr><td><img id='bar_img_2' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_2.gif" width="1" height="12" barwidth=310></td></tr>
<tr><td><img id='bar_img_3' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_3.gif" width="1" height="12" barwidth=180></td></tr>
<tr><td><img id='bar_img_4' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_4.gif" width="1" height="12" barwidth=320></td></tr>
<tr><td><img id='bar_img_5' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_5.gif" width="1" height="12" barwidth=290></td></tr>
<tr><td><img id='bar_img_6' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_6.gif" width="1" height="12" barwidth=380></td></tr>
<tr><td><img id='bar_img_7' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_0.gif" width="1" height="12" barwidth=280></td></tr>
<tr><td><img id='bar_img_8' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_1.gif" width="1" height="12" barwidth=250></td></tr>
<tr><td><img id='bar_img_9' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_2.gif" width="1" height="12" barwidth=300></td></tr>
<tr><td><img id='bar_img_10' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_3.gif" width="1" height="12" barwidth=180></td></tr>
<tr><td><img id='bar_img_11' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_4.gif" width="1" height="12" barwidth=270></td></tr>
<tr><td><img id='bar_img_12' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_5.gif" width="1" height="12" barwidth=290></td></tr>
<tr><td><img id='bar_img_13' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_6.gif" width="1" height="12" barwidth=280></td></tr>
</table>
<table cellspacing=2 cellpadding=2 border=0 class=ybox_id>
<tr>
<td><img id='ybar_img_0' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_0.gif" width="12" height="1" barheight=60></td>
<td><img id='ybar_img_1' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_1.gif" width="12" height="1" barheight=75></td>
<td><img id='ybar_img_2' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_2.gif" width="12" height="1" barheight=160></td>
<td><img id='ybar_img_3' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_3.gif" width="12" height="1" barheight=40></td>
<td><img id='ybar_img_4' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_4.gif" width="12" height="1" barheight=120></td>
<td><img id='ybar_img_5' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_5.gif" width="12" height="1" barheight=95></td>
<td><img id='ybar_img_6' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_6.gif" width="12" height="1" barheight=90></td>
<td><img id='ybar_img_7' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_0.gif" width="12" height="1" barheight=140></td>
<td><img id='ybar_img_8' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_1.gif" width="12" height="1" barheight=75></td>
<td><img id='ybar_img_9' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_2.gif" width="12" height="1" barheight=160></td>
<td><img id='ybar_img_10' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_3.gif" width="12" height="1" barheight=40></td>
<td><img id='ybar_img_11' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_4.gif" width="12" height="1" barheight=100></td>
<td><img id='ybar_img_12' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_5.gif" width="12" height="1" barheight=95></td>
<td><img id='ybar_img_13' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_6.gif" width="12" height="1" barheight=90></td>
<td><img id='ybar_img_14' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_0.gif" width="12" height="1" barheight=140></td>
<td><img id='ybar_img_15' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_1.gif" width="12" height="1" barheight=75></td>
<td><img id='ybar_img_16' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_2.gif" width="12" height="1" barheight=160></td>
<td><img id='ybar_img_17' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_3.gif" width="12" height="1" barheight=40></td>
<td><img id='ybar_img_18' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_4.gif" width="12" height="1" barheight=50></td>
<td><img id='ybar_img_19' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_5.gif" width="12" height="1" barheight=95></td>
<td><img id='ybar_img_20' border="0" src="http://www.hompydesign.com/open_source/images/status_bar_6.gif" width="12" height="1" barheight=90></td>
</tr>
</table>
</BODY>
</HTML>
사용자 삽입 이미지

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
2008/01/06 10:52 2008/01/06 10:52

댓글을 달아 주세요

  1. 오페라,파이어폭스,크롬 2009/04/06 23:12  댓글주소  수정/삭제  댓글쓰기

    요즘 웹표준이란 익스플로러 홍역을 치르고 이곳저곳을
    다른브라우저로 보곤합니다;;
    설명해주신 태그가 익스플로러에서만 적용되는 소스같네요
    이름에 적어둔 브라우저에서 모두 작동이 되지않습니다
    오픈캐스트 메인으로 설정해서 보는 곳인데,,

    익스플로러기반이아닌 웹표준 기반을 따른 웹소스를 적용해주시면
    더좋을것같네요;;

자바스크립트로 구성된 이미지 슬라이더입니다. 아래 HTML 소스를 sample.html 로 저장하고 실행하면 아래 화면 처럼 출력이 됩니다. 자바스크립트 입문자에게는 공부가 될만한 소스이며 자신의 필요에 맞게 커스터마이징해서 실무에 활용해볼 수 있습니다. 앞으로 자바스크립트(javascript)를 학습하는 입문자 분들에게 공부가 될만한 미니 소스들을 이따금씩 준비해볼까 합니다.



<HTML>
<HEAD>
<TITLE>이미지 스크롤</TITLE>

<style type="text/css">
a:link{color:#fff; text-decoration:none;}
a:visited{color:#fff; text-decoration:none;}
a:hover{color:#fff; text-decoration:underline;}
a:link{color:#fff; text-decoration:none;}
img{border:0px;}

.select_direction{cursor:hand}
ul, li {list-style:none; padding:0; margin:0;}

.slider_td{padding-top:16px;}
.slider_ul li {width:59px; height:64px; padding-right:9px; float:left; white-space: nowrap; overflow:hidden; }
.slider_ul li img {vertical-align:top; border:1px solid #eeeeee; width:57; height:40;white-space: nowrap;}
.slider_ul li h1 {font-family:"돋움",tahoma,verdana; padding:0; margin:0; width:59px; height:20px; line-height:20px; overflow:hidden; text-align:center; font-size:11px; font-weight:normal; padding-top:2px;white-space: nowrap;}
</style>

<script>
var my_config = [];
with (my_config) {
 my_config.speed = "30";
 my_config.scroll = 1;
 my_config.width = "500";
 my_config.height = "70";
 my_config.direction = "left";
 my_config.banners;
 my_config.slider;
 my_config.slider_1;
 my_config.slider_2;
 my_config.timer;
}
function autoScroll(type){
 my_config.direction = type;
 this.items = [];
 this.add_banner = function(image,link,title,target){
  var newItem  = {};
  newItem.image = image;
  newItem.link = link;
  newItem.title = title;
  newItem.target = target;
  this.items[this.items.length] = newItem;
 }

 this.play = function(){
  my_config.banners = this.items;
  scroll_html();
  with (my_config) {
   slider=document.getElementById("slider_box");
   slider_1=document.getElementById("slider_box_1");
   slider_2=document.getElementById("slider_box_2");
   slider_2.innerHTML=slider_1.innerHTML;
   timer=setInterval(do_timer,speed);
  }
 }
}

function scroll_html(){
 var str = "", tmp = "", b = "", c ="", d = "";
 for(var i=0;i<my_config.banners.length;i++){
   var a = my_config.banners[i]
   str += "<li><a href='"+a.link+"' target='"+a.target+"'><img src='"+a.image+"' width=57 height=40 title='"+a.title+"'></a><h1><a href='"+a.link+"' >"+a.title+"</a></h1></li>";
 }
 if (my_config.direction == "left" || my_config.direction == "right"){
  b = "<div id=slider_scroller style='float: left; width: 800%'>";
  c = " style='float: left'";
  d = "</div>";
 }
 tmp += "<div id=slider_box onmouseover='do_stop()' onmouseout='do_move()' style='overflow:hidden; width:"+my_config.width+"px; height:"+my_config.height+"px'>";
 tmp += b + "<div id=slider_box_1"+c+">" + str;
 tmp += "</div><div id=slider_box_2"+c+">"+d+"</div></div>";
 document.getElementById("slider_show").innerHTML = tmp;
}

function do_left() {my_config.direction='left'}
function do_right() {my_config.direction='right'}
function do_stop() {my_config.scroll=0}
function do_move() {my_config.scroll=1}

function do_timer(){
 with(my_config){
  if (scroll) {
   if (direction == "top"){
    if (slider_2.offsetTop-slider.scrollTop<=0){ slider.scrollTop-=slider_1.offsetHeight }
    else {slider.scrollTop++}
   } else if(direction == "down"){
    if (slider_1.offsetTop-slider.scrollTop>=0) slider.scrollTop+=slider_2.offsetHeight
    else {slider.scrollTop--}
   } else if (direction == "left"){
    if (slider_2.offsetWidth-slider.scrollLeft<=0) slider.scrollLeft-=slider_1.offsetWidth
    else {slider.scrollLeft++;}
   } else if (direction == "right"){
    if (slider.scrollLeft<=0) slider.scrollLeft+=slider_2.offsetWidth
    else {slider.scrollLeft--}
   }
  }
 }
}

function play_game (type){
 if (my_config.timer) clearInterval(my_config.timer);
 var direction = type;
 var obj = new autoScroll(type);
 obj.add_banner("http://hompy.info/attach/1/1057862274.jpg","http://hompy.info/179#1","사진 #1","_blank");
 obj.add_banner("http://hompy.info/attach/1/1091749905.bmp","http://hompy.info/179#2","사진 #2","_blank");
 obj.add_banner("http://hompy.info/attach/1/1088322503.jpg","http://hompy.info/179#3","사진 #3","_blank");
 obj.add_banner("http://hompy.info/attach/1/1214111187.gif","http://hompy.info/179#4","사진 #4","_blank");
 obj.add_banner("http://hompy.info/attach/1/1195784232.png","http://hompy.info/179#5","사진 #5","_blank");
 obj.add_banner("http://hompy.info/attach/1/1342744226.jpg","http://hompy.info/179#6","사진 #6","_blank");
 obj.add_banner("http://hompy.info/attach/1/1290697956.jpg","http://hompy.info/179#7","사진 #7","_blank");
 obj.add_banner("http://hompy.info/attach/1/1323206309.jpg","http://hompy.info/179#8","사진 #8","_blank");
 obj.add_banner("http://hompy.info/attach/1/1221839979.jpg","http://hompy.info/179#9","사진 #9","_blank");
 obj.add_banner("http://hompy.info/attach/1/1348078903.png","http://hompy.info/179#10","사진 #10","_blank");
 obj.add_banner("http://hompy.info/attach/1/1389674041.png","http://hompy.info/179#11","사진 #11","_blank");
 obj.add_banner("http://hompy.info/attach/1/1204919872.jpg","http://hompy.info/179#12","사진 #12","_blank");
 obj.add_banner("http://hompy.info/attach/1/1015707056.jpg","http://hompy.info/179#13","사진 #13","_blank");
 obj.add_banner("http://hompy.info/attach/1/1139032860.jpg","http://hompy.info/179#14","사진 #14","_blank");
 obj.play();
}
</script>
</HEAD>
<BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
 <td width="20" class="select_direction" onclick="do_left();return false;" align=right>◁</td>
 <td class="slider_td" style="background-color:#111111">
  <ul class="slider_ul" id="slider_show"></ul>
 </td>
 <td width="20" class="select_direction" onclick="do_right();return false;">▷</td>
</tr>
</table>
<script>
play_game("left");
</script>
</BODY>
</HTML>

웹프로그래머의 홈페이지정보 블로그 http://hompy.info

2007/12/28 08:46 2007/12/28 08:46

댓글을 달아 주세요

  1. david 2011/11/03 11:01  댓글주소  수정/삭제  댓글쓰기

    이미지 스크롤 스크립트 관련 질문입니다...이미지 스크롤 스크립트에서 이미지 사이즈를 키우게 되면 이미지가 6개 정도만 나오고 롤링이 멈추어버리는데 무슨 문제인지 모르겠네요...아시는 분 알려주시기 바랍니다..감사합니다..

  2. mikali 2009/12/18 18:24  댓글주소  수정/삭제  댓글쓰기

    역시 자바.. 못따라가요..ㅠㅠ 감사합니다.

  3. 비밀방문자 2009/10/09 15:56  댓글주소  수정/삭제  댓글쓰기

    관리자만 볼 수 있는 댓글입니다.

  4. 와웅 2009/06/26 21:30  댓글주소  수정/삭제  댓글쓰기

    감사합니다

  5. brave 2009/06/23 17:47  댓글주소  수정/삭제  댓글쓰기

    감사합니다...

  6. 뮤직바 2009/03/18 14:17  댓글주소  수정/삭제  댓글쓰기

    급하게 스크립트소스가 필요했는데... 손볼 필요도 없이 딱 원하는 내용이네요.
    감사히 담아갑니다.

  7. skj 2009/02/27 17:30  댓글주소  수정/삭제  댓글쓰기

    우와 짱~~~

    자바스크립트는 넘 어려워요!~~~ㅜ ㅜ

  8. yik 2008/12/10 08:35  댓글주소  수정/삭제  댓글쓰기

    감사히 담아갑니다. 프로그램에는 꽝인 디자이너입니다. 좋은 소스로 열심히 공부를!! ㅋ 좋은 하루 보내시길 바랍니다.^^

다음 웹인사이드 페이지분석/종료페이지를 이용하여 블로그 인기 페이지들을 추출해서 편집했다. 그런데 편집하는 시간이 은근히 많이 걸렸다.^^ 조회기간은 2007년 5월 16일 부터 6월 16일까지이며 메인페이지는 목록에서 삭제했다. 눈에 띄게 높은 방문자수를 보이는 미니채팅한자게임은 나란히 1, 2위를 달리고 있고 테트리스 게임문서 편집에 관한 포스트 그리고 플래시 추천 홈페이지가 4, 5, 6 위에 랭크되었다. 방문 경로는 직접 주소를 입력해서 건너오는 경우가 50%, 올블로그 와 이올린 그리고 네이버 카페를 통해서 오는 경우가 각각 10%였고 네이버 검색으로 60%, 엠파스와 구글을 통해 각각 10% 방문하였다.
웹사이트(웹로그)의 분석을 도와주는 다음 웹인사이드와 같은 서비스로 Google Analytics 가 있다. 국내에 이런 서비스를 해주는 곳으로 로거, 에이스카운터 등이 있고 아마도 유료 서비스인 것 같다. 홈페이지를 운영하는 사람의 입장에서 웹로그 분석은 인터넷 마케팅에 있어 매우 중요한 역할을 차지한다. 그래서 유료 서비스를 하더라도 이용을 하는 모양이다. 블로그나 홈페이지를 운영하고 있는 분이라면 이런 류의 서비스를 하나 이상 써보는 것을 추천해본다.
http://hompy.info/23 나만의 블로그/카페/클럽 실시간 미니채팅 만들기 4,411
http://hompy.info/6 급수 별로 즐기는 재미있는 한자 게임 (플래시) 1,516
http://hompy.info/104 테트리스 게임, 저작권문제로 사라졌다? 352
http://hompy.info/103 단순 무식한 문서편집은 이제 그만! (정규식의 활용) 239
http://hompy.info/111 플래시로 만든 비쥬얼이 멋진 홈페이지 194
http://hompy.info/119 국산 인기 게임 플래시 버젼 2가지 182
http://hompy.info/105 이쁜 블로그 타이틀 스킨 만들어드려요. 170
http://hompy.info/93 빠른 블로그 운영을 위해 새 서버를 샀다.^^ 162
http://hompy.info/113 플래시 슈팅 게임으로 머리좀 식혀봅시다. 150
http://hompy.info/96 직장동료에게 닌텐도DS 생일 선물 하다. 149
http://hompy.info/116 재미있는 플래시 폭탄 게임 146
http://hompy.info/97 미친듯이 스크롤되는 미니 대화방 142
http://hompy.info/101 미니 테트리스 게임(tetris game) 랭킹 기능 추가 141
http://hompy.info/102 스크랩 금지된 블로그 포스트 스크랩하기 #2 129
http://hompy.info/99 애플(apple)의 아이폰(iphone) 소개 동영상들, 군침 돈다!. 125
http://hompy.info/86 직장인 블로그 유져를 위한 정모 참가 신청 받습니다. 120
http://hompy.info/100 PC 전문지에서 인터뷰 요청을 받았다. 그래서... 116
http://hompy.info/117 재미있는 플래시 풍선 게임 3종 세트 114
http://hompy.info/118 검색포털 홈페이지 등록 경험담, 네이버에 블로그 등록 완료. 99
http://hompy.info/115 플래시 다운로드 및 복사 방법 이모저모 97
http://hompy.info/95 스타크래프트 배틀넷 서버 설치 동영상 90
http://hompy.info/94 직장인 블로거 정모 후기 (2007년 6월 2일) 87
http://hompy.info/106 이쁜 블로그 타이틀 스킨 만들어드려요-1번 신청자 baramare 님 75
http://hompy.info/112 추천 플래시 홈페이지 #2 75
http://hompy.info/110 최신 구인정보 플래시 (웹프로그래머,웹디자이너) 73
http://hompy.info/114 추천 플래시 홈페이지 #3 70
http://hompy.info/92 재미있는 한자게임 개발 에피소드... 62
http://hompy.info/98 자동검색이 되는 플래시 단어 검색기 58
http://hompy.info/109 실시간 검색어 플래시 키워드 나우 #20070610 50
http://hompy.info/91 엔지니어도 대접받는 사회를 바란다. 45

웹프로그래머의 홈페이지정보 블로그 http://hompy.info
2007/06/16 11:40 2007/06/16 11:40

댓글을 달아 주세요

초보자를 위한 자바스크립트 이미지 슬라이더 소스코드

자바스크립트(javascript) 입문자를 위한 자바스크립트 이미지 슬라이더입니다. 오른쪽에서 왼쪽으로 이동하며, 회전됩니다. 응용하셔서 왼쪽으로 위로 아래로 이동하는 이미지 슬라이더를 직접 만들어 보세요. 본 소스는 초보자를 위해 최대한 간소화해서 코딩되었습니다.


<HTML>
<HEAD>
<TITLE>초간단 이미지 슬라이더 회전 : http://hompy.info</TITLE>
<script>
var step = -1, stime = 10, wtime = 1000, ep;
var sleep = stime, cell = 100, total = 4, width = cell * total;
function do_stop(){
clearTimeout(ep);
}
function do_move(){
var obj = photo_layer.style;
obj.pixelLeft = (obj.pixelLeft + step) % width;
if (obj.pixelLeft % cell == 0) sleep = wtime;
ep = setTimeout("do_move()",sleep);
sleep = stime;
}
</script>
</HEAD>
<BODY onload="do_move();">
<div style="top: 10px; left: 10px; height: 100px; width: 400px; position: absolute; overflow:hidden" onmouseout="do_move()" onmouseover="do_stop()">
<div id="photo_layer" style="top: 0px; left: -300px; width: 800px; height: 80px; position: absolute;">
<table height="80" cellspacing="0" cellpadding="0" id="table7" >
<tr align=center height=100 bgcolor="#cccccc">

<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvMTUuanBn" width=98></td>
<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvMy5qcGc=" width=98></td>
<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvNS5qcGc=" width=98></td>
<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvOS5qcGc=" width=98></td>

<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvMTUuanBn" width=98></td>
<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvMy5qcGc=" width=98></td>
<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvNS5qcGc=" width=98></td>
<td width=100><IMG src="http://cfs2.tistory.com/upload_control/download.blog?fhandle=YmxvZzU3NDk1QGZzMi50aXN0b3J5LmNvbTovYXR0YWNoLzAvOS5qcGc=" width=98></td>

</tr>
</table>
</div>
</div>
</BODY>
</HTML>


웹프로그래머의 홈페이지정보 블로그 http://hompy.info
2007/04/20 08:51 2007/04/20 08:51

댓글을 달아 주세요

  1. yik 2008/12/10 08:46  댓글주소  수정/삭제  댓글쓰기

    감사히 담아갑니다.

스크랩 금지된 네이버 블로그와 카페글을 스크랩하고 싶다면...
해당 게시물을 띄운 상태에서 아래와 같은 자바스크립트를 사용하면 필요한 내용들을 복사해서 사용할 수 있습니다. 그러나 저작권이 있는 자료인 경우는 주의 깊게 사용할 필요는 있겠지요.

우선 네이버 블로그 게시물에 사용할 수 있는 자바스크립트입니다.

javascript:function x(){mainFrame.papermain.document.body.oncontextmenu=null;mainFrame.papermain.document.body.onselectstart=null;mainFrame.papermain.document.body.ondragstart=null} x();

이번에는 네이버 카페 게시물에 사용할 수 있는 자바스크립트입니다.

javascript:function x(){document.body.oncontextmenu=null;document.body.onselectstart=null;document.body.ondragstart=null;cafe_main.document.oncontextmenu=null;cafe_main.document.onselectstart=null;cafe_main.document.ondragstart=null;} x();

원리는 간단합니다. 해당 객체의 이벤트를 무력화 하는 것입니다. 응용하시면 다른 사이트에서도 활용하실 수 있겠죠.
자바스크립트를 모르는 분들을 위해 부연 설명을 하면, 주소 창에 위에 있는 스크립트를 한줄이 되도록 복사 후에 붙여 넣기 하시면 됩니다. 더 편하게 사용하려면 아무 웹페이지나 즐겨 찾기를 해둔후 속성을 변경하면 되는데, 속성창에 url를 위 자바스크립트로 대체하시면 됩니다. 즐겨찾기 이름은 간단하게 정하시고, 해당 즐겨찾기의 이름을 주소창에 입력하시면 간단히 원하는 사이트로 가거나 자바스크립트를 실행시킬 수 있습니다.
자주 이용하는 사이트라면 즐겨찾기 이름은 숫자나 영문자 1자로 정하면  더 편합니다.
주소창으로 바로가는 단축키 ALT+D 와 함께 이용하시면 더욱 좋겠죠.

앞으로 짬짬히 시간을 내서 유용한 자바스크립트에 대해서 소개하도록 하겠습니다.

http://hompy.info
2007/04/01 23:04 2007/04/01 23:04

댓글을 달아 주세요

  1. kinkh 2010/02/21 17:59  댓글주소  수정/삭제  댓글쓰기

    자바스크립트 프로토콜이 등록된 프로그램을 가지고 있지 않다고 나오는데 어떻게 해야되나요?

  2. xogo 2009/02/27 14:00  댓글주소  수정/삭제  댓글쓰기

    좋은자료 감사합니다 ㅎㅎ
    파폭이나 오페라가 뭔지도 모르는 저같은 초짜에겐 큰 도움이 됐어요 ㅋ;;

  3. 까칠한tagrag 2007/04/03 22:38  댓글주소  수정/삭제  댓글쓰기

    저는 오페라 쓰는데 ...
    그럼 어렵지 않은데요...

  4. mcsong 2007/04/03 11:39  댓글주소  수정/삭제  댓글쓰기

    그러게요..
    파폭쓰면 잘 긁어집니당.. ㅋㅋ

  5. 아르 2007/04/03 10:29  댓글주소  수정/삭제  댓글쓰기

    ...그냥 파이어폭스 쓰죠 뭐...