'2008/02/02'에 해당되는 글 110건

  1. 2008.02.02 tertris(태트리스) 게임
  2. 2008.02.02 메뉴 자동 생성기 (DHTML)
  3. 2008.02.02 공백만으로 구성된 문자열 체크
  4. 2008.02.02 간단하게 글자수 제한하기
  5. 2008.02.02 이미지 실시간 보여주기, 용량체크, 스타일동적교체
  6. 2008.02.02 한글 입력 방지
  7. 2008.02.02 영문, 영어 입력 방지
  8. 2008.02.02 새창 띄우고 부모창 닫을때 묻지 않고 조용히 닫기
  9. 2008.02.02 이미지 없을때 표시되지 않게 하는 방법
  10. 2008.02.02 [스타일시트] 프린트할때 출력되게 하기
  11. 2008.02.02 창에서의 F11, F5, Ctrl 비활성화 스크립트
  12. 2008.02.02 이메일 수집기 방어를 위한 스크립트
  13. 2008.02.02 사업자등록번호, 주민등록번호 등 편리하게 붙혀넣기
  14. 2008.02.02 자식창에서 부모창으로 submit 하기
  15. 2008.02.02 숫자만 입력되었는지 체크하기
  16. 2008.02.02 인풋 박스 숫자 입력시 툴팁으로 표시
  17. 2008.02.02 슬라이드 메뉴
  18. 2008.02.02 테이블크기 늘리기,줄이기,초기값지정
  19. 2008.02.02 CSS 만으로 만든 롤오버 이미지
  20. 2008.02.02 이미지 안쓰고 모서리 둥근 테이블 만들기 2
  21. 2008.02.02 해상도에따른 브라우저 크기조절
  22. 2008.02.02 글쓰기폼 늘리기 - 확장, 축소
  23. 2008.02.02 투명한 textarea
  24. 2008.02.02 텍스트 밑줄 긋기
  25. 2008.02.02 토글 메뉴
  26. 2008.02.02 웹페이지에 삽입된 동영상 및 음악 제어
  27. 2008.02.02 이미지 안쓰고 모서리(테두리) 둥근 테이블 만들기
  28. 2008.02.02 스포트라이트 효과
  29. 2008.02.02 PNG 그림파일 알파값 살리기
  30. 2008.02.02 팝업창에 관한 모든것(새창)
복사해서 태그연습장이나 html 문서를 만드세요.

<!--

파일명 : TETRIS.html (JavaScript를 이용한 테트리스 게임)
제작자 : 김연진
제작일 : 2004. 6. 23 Taeyo.Net 사이트에 올라온 소스
수정자 : 강현석
수정일 : 2004. 6. 29.
수정내용 : 본소스에서 테트리스 블럭중 빠진 블럭 2가지(┌┘,└┐)를 추가하고,
           몇가지 변수들과 레벨업을 제 나름대로 수정했으며 태그도 조금 손을 보았습니다.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language='javascript'>
var cx = 12; // x 축 크기
var cy = 28; // y 축 크기
var background = "black"; // 백그라운드 색

// 점수를 동시 삭제행이 많을수록 점수가 기하급수적으로 늘어나도록 조정
var scoreRule = new Array(1, 10, 40, 90, 160); // 점수 규칙 ( 행삭제갯수가 0 이면 1, 1이면 10, ... )
// 본인이 너무 빠른 속도에 적응을 못하기 때문에 조금 속도를 늦추면서 단계간의 격차를 일률적으로 조정
var speed = new Array(1000, 700, 490, 343, 240, 168, 117, 82, 57, 40); // 레벨에 따른 속도 ( 레벨1 : 1 초에 1칸, 레벨2 : 0.7초에 한칸 ... )
// 블럭을 모양에 따라 서로 비슷한 색을 띄도록 수정하고 추가된 블럭에 맞게 2가지 색상을 추가
var colors = new Array("#999999", "#3399ff", "#9933ff", "#33ff99", "#99ff33", "#ff9933", "#ff3399"); // 블럭별 색

var x, y; // 블럭 위치
var score = 0; // 점수
var level = 0; // 레벨 (0->1레벨)

// 추가된 변수 (레벨업에 관련된 변수)
var totalEraseLine = 0; // 총 삭제행 수
var chkLevelUp = 0; // 레벨업을 체크변수(최종 레벨의 삭제행 수를 저장)
var stepLevelLine  = 10 // 레벨업이 몇 삭제행 단위로 동작하는지 (5이상으로 설정)

var blockTotal; // 떨어진 블럭 총 갯수

var lx = 25; ly = 25; // 블럭 위치 조정값

var shapeNo = 0;
var rix = 0;
var shape;
var shapeColor;
var nextShape;

var timeoutID;

var area = new Array(cx*cy);

function startTetris() {
        if(document.all.btnStart.value == '포기!') {
                if(confirm("게임을 포기하겠습니까 ?")) {
                        clearTimeout(timeoutID);
                        alert("게임 끝 ~~~ 점수 : " + score + " / 삭제행 : " + totalEraseLine);
                        location = "?d=" + escape(new Date());
                        return;
                } else {
                        return;
                }
        }
        document.all.btnStart.value = "포기!";
        clearTimeout(timeoutID);
        level = 0;
        blockTotal = 0;

//        showLevel(); 처음에는 레별표시를 지움

        nextShape = Math.floor(Math.random()*matrix.length);

        score = 0;
        document.all.txtScore.value = 0;

        for(var i=0; i<area.length; i++) {
                area[i] = 0;
                document.all.bg[i].style.backgroundColor = background;
        }
        down();
}

function showLevel() {
        document.all.blockSpan.style.visibility = "hidden";
        alert("LEVEL " + (level + 1));
        document.all.blockSpan.style.visibility="visible";
}

function doMove(n) {
        if(!canMove(x+n, y, shape)) { return; }
        x += n;
        moveTetris(x, y, 0);
}

function fixBlock(x, y, shp) {
        var lineElasped = 0;

        for(var i=0; i<shp.length; i++) {
                var c = 8;
                var ni = shp[i];
                if(ni > 0) {
                        for(var j=0; j<4; j++) {
                                if((ni&c) > 0) {
                                        var dx = x + j;
                                        var dy = y + i;
                                        var pno = dy * cx + dx;
                                        area[pno] = shapeNo + 1;
                                        document.all.bg[pno].style.backgroundColor = colors
[shapeNo];
                                }
                                c >>= 1;
                        }
                }
        }
        var redraw = -1;
        for(var i=0; i<cy; i++) {
                var pno = i * cx;
                for(var j=0; j<cx; j++) {
                        if(area[pno++] == 0) { break; }
                }
                if(j == cx) {
                        lineElasped++;
                        totalEraseLine++;
                        for(var k=i; k>0; k--) {
                                var pd = k*cx; var ps = (k-1)*cx;
                                for(var j=0; j<cx; j++) {
                                        area[pd] = area[ps];
                                        pd++; ps++;
                                }
                        }
                        redraw = i;
                }
        }
        if(redraw >= 0) {
                for(var i=0; i<(redraw+1)*cx; i++) {
                        document.all.bg[i].style.backgroundColor=area[i]==0 ? background : colors
[area[i]-1];
                }
        }
        score += scoreRule[lineElasped];
        document.all.txtScore.value = score;
        blockTotal++;

// 레벨업 방법을 블럭갯수에서 삭제행 수로 계산방법을 변경
        if((totalEraseLine - chkLevelUp - stepLevelLine >= 0) && (level < 9)) {
                level++;
                chkLevelUp += stepLevelLine
                showLevel();
        }
}

function canMove( x, y, shp ) {
        for(var i=0; i<shp.length; i++) {
                var c = 8;
                var ni = shp[i];
                if(ni > 0) {
                        for(var j=0;j<4;j++) {
                                if((ni&c) > 0) {
                                        var dx = x+j;
                                        var dy = y+i;
                                        if(dx<0 || dx>=cx || dy<0 || dy>=cy) { return false; }
                                        if(area[cx*dy+dx] > 0) { return false; }
                                }
                                c >>= 1;
                        }
                }
        }
        return true;
}

function rotate() {
        var l = matrix[shapeNo].length;
        nrix = (rix + 1) % l;
        if(!canMove(x, y, matrix[shapeNo][nrix])) { return; }
        shape = matrix[shapeNo][nrix];
        shapeColor = colors[shapeNo];
        rix = nrix;
        makeShape();
}

function checkKey() {
        var c = String.fromCharCode(event.keyCode);
        if(c=='j' || c=='J') { doMove(-1); }
        if(c=='l' || c=='L') { doMove(+1); }
        if(c=='i' || c=='I') { rotate(); }
        if(c=='k' || c=='K') {
                clearTimeout(timeoutID);
                while(canMove(x, y+1, shape)) { y++; }
                downFunc();
        }
}

var yc = 0;

function moveTetris(x, y, yc) {
        document.all.blockSpan.style.pixelTop = y * 20 + ly;
        document.all.blockSpan.style.pixelLeft = x * 20 + lx;
}

function downFunc() {
        if(!canMove(x, y+1, shape)) {
                fixBlock(x, y, shape);
                down();
                return;
        }
        moveTetris(x, ++y, yc);
        timeoutID = setTimeout(downFunc,speed[level]);
}

function down() {
        shapeNo = nextShape;
        nextShape = Math.floor(Math.random() * matrix.length);
        shape = matrix[nextShape][0];
        shapeColor = colors[nextShape];
        makeShapePreview();

        shape = matrix[shapeNo][0];
        shapeColor = colors[shapeNo];
        makeShape();

        document.all.blockSpan.style.visibility = "visible";
        document.all.blockPreview.style.visibility = "visible";

        rix = 0;
        y = -1; x = 5; yc = 0;
        if(!canMove(x, y+1, shape)) {
//                alert("게임 끝 ~~~ 당신의 점수는 " + score + "점이며 총 " + totalEraseLine + "입니다.\n등수는 랭킹페이지에서 확인 할 수 있습니다.");
                alert("게임 끝 ~~~ 점수 : " + score + " / 삭제행 : " + totalEraseLine);
                clearTimeout(timeoutID);
//                location = "rank.asp?game=tetris&score=" + score;
                location = "?d=" + escape(new Date());
                return;
        }

        downFunc();
}

// 블럭에서 빠진 2개의 블럭 배열을 추가
var matrix = new Array (
        new Array (
// 0000
// 0110
// 0110
// 0000
                new Array( 0x0, 0x6, 0x6, 0x0 )
        ),
        new Array ( // 추가된 블럭
// 0000 1000
// 0110 1100
// 1100 0100
// 0000 0000
                new Array( 0x0, 0x6, 0xc, 0x0 ),
                new Array( 0x8, 0xc, 0x4, 0x0 )
        ),
        new Array ( // 추가된 블럭
// 0000 0100
// 1100 1100
// 0110 1000
// 0000 0000
                new Array( 0x0, 0xc, 0x6, 0x0 ),
                new Array( 0x4, 0xc, 0x8, 0x0 )
        ),
        new Array (
// 0000 0100 0010 1100
// 1110 0100 1110 0100
// 1000 0110 0000 0100
// 0000 0000 0000 0000
                new Array( 0x0, 0xe, 0x8, 0x0 ),
                new Array( 0x4, 0x4, 0x6, 0x0 ),
                new Array( 0x2, 0xe, 0x0, 0x0 ),
                new Array( 0xc, 0x4, 0x4, 0x0 )
        ),
        new Array (
// 0000 0110 1000 0100
// 1110 0100 1110 0100
// 0010 0100 0000 1100
// 0000 0000 0000 0000
                new Array( 0x0, 0xe, 0x2, 0x0 ),
                new Array( 0x6, 0x4, 0x4, 0x0 ),
                new Array( 0x8, 0xe, 0x0, 0x0 ),
                new Array( 0x4, 0x4, 0xc, 0x0 )
        ),
        new Array (
// 0000 0100 0100 0100
// 1110 0110 1110 1100
// 0100 0100 0000 0100
// 0000 0000 0000 0000
                new Array( 0x0, 0xe, 0x4, 0x0 ),
                new Array( 0x4, 0x6, 0x4, 0x0 ),
                new Array( 0x4, 0xe, 0x0, 0x0 ),
                new Array( 0x4, 0xc, 0x4, 0x0 )
        ),
        new Array (
// 0000 0100
// 1111 0100
// 0000 0100
// 0000 0100
                new Array( 0x0, 0xf, 0x0, 0x0 ),
                new Array( 0x4, 0x4, 0x4, 0x4 )
        )
);


function makeShapePreview() {
        makeShapeB(document.all.pblock);
}

function makeShape() {
        makeShapeB(document.all.block);
}

function makeShapeB( blocks ) {
        var sh = shape;
        var co = 0;
        var col = shapeColor;
        for(var i=0; i<4; i++) {
                var ix = 8;
                for(var j=0; j<4; j++) {
                        if((ix&sh[i]) > 0) {
                                blocks[co].style.backgroundColor = col;
                                blocks[co].style.borderColor = col;
                                blocks[co].style.pixelLeft = j * 20;
                                blocks[co].style.pixelTop = i * 20;
                                co++;
                        }
                        ix >>= 1;
                }
        }
}
        </script>

</head>
<body onkeyPress="checkKey();" leftmargin="20" topmargin="20" bgcolor="#333333">
<table cellpadding="0" cellspacing="5" bgcolor="#666666" border="0">
<tr>
        <td>
                <table border="0" cellpadding="0" bgcolor="#333333" cellspacing="1">
<script language='javascript'>
for(var i=0; i<cy; i++) {
        document.write("<tr height='19'>");
        for(var j=0;j<cx;j++) {
                document.write("<td width='19' id='bg' bgcolor='" + background + "'> </td>");
        }
        document.write("</tr>");
}
</script>
                </table>
        </td>
        <td valign="top" bgcolor="gray" align="center">
                <br>
                <span style="font-weight: bold; color: #CCCCCC; height: 41; vertical-align:
center;">TETRIS</span>
                <br>
                <table border="0" cellpadding="0" bgcolor="#333333" cellspacing="1">
<script language='javascript'>
for(var i=0; i<4; i++) {
        document.write("<tr height='19'>");
        for(var j=0; j<4; j++) {
                document.write("<td width='19' bgcolor='" + background + "'> </td>");
        }
        document.write("</tr>");
}
</script>
                </table>
                <br>
                SCORE:<br>
                <input type="text" id="txtScore" style="border: 1px solid black; font-weight: bold; font-
family: verdana; font-size: 11pt; width: 100%; text-align: right; background-color: black; color: #FFFFFF;"><br>
                <input type="button" id="btnStart" value="시작!" onfocus="blur()" onclick="startTetris()"
style="width:100%">
                <br>
                <table width="100%" border="0" cellspacing="0" cellpadding="4" style="font-size: 10pt;
font-weight: bold;">
                <tr align="center">
                        <td>J</td>
                        <td>:</td>
                        <td align="left">왼쪽</td>
                </tr>
                <tr align="center">
                        <td>L</td>
                        <td>:</td>
                        <td align="left">오른쪽</td>
                </tr>
                <tr align="center">
                        <td>K</td>
                        <td>:</td>
                        <td align="left">아래</td>
                </tr>
                <tr align="center">
                        <td>I</td>
                        <td>:</td>
                        <td align="left">회전</td>
                </tr>
                </table>
                <br>
                <br>
                <table width="100%" border="0" cellspacing="0" cellpadding="4" style="font-size: 10pt;
color: #ffffff;">
                <tr align="center">
                        <td>글자크기는</td>
                </tr>
                <tr align="center">
                        <td>보통으로..</td>
                </tr>
                </table>
                <br>
                <br>
                <br>
                <br>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size: 9pt;
color: #cccccc;">
                <tr align="center">
                        <td>제작자:김연진</td>
                </tr>
                <tr align="center">
                        <td> </td>
                </tr>
                <tr align="center">
                        <td>수정자:강현석</td>
                </tr>
                </table>
        </td>
</tr>
</table>

<span style="position: absolute; visibility: hidden;" id="blockSpan">
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="block"></span>
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="block"></span>
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="block"></span>
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="block"></span>
</span>

<span style="position:absolute;left:271;top:85;visibility:hidden" id="blockPreview">
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="pblock"></span>
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="pblock"></span>
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="pblock"></span>
        <span style="width: 20; height: 20; border: 1px solid #CCCCCC; position: absolute;"
id="pblock"></span>
</span>


</html>
Posted by 알 수 없는 사용자
,
Posted by 알 수 없는 사용자
,
if (f.title.value.split(" ").join("").length == 0){
    alert('공백만으로 구성된 제목은 허용하지 않습니다.');
    f.title.value='';
    f.title.focus();
    return false;
}
Posted by 알 수 없는 사용자
,
<textarea name="memo" cols=50 rows="10" onKeyUp="if(this.value.length>10){window.alert('10 자 초과입니다.');}">
</textarea>

<input value="" type=text width=200 onKeyUp="if(this.value.length>10){window.alert('10 자 초과입니다.');}">
Posted by 알 수 없는 사용자
,
<title>이미지실시간보여주기, 용량체크하기, 스타일동적교체</title>
<style type=text/css>
.upbg3 {
display:visible;
}
.kk {
display:none;
}
</style>

<script>
<!--
function imgChange( img ) {
var cs_img = document.all.coverstory_img;

if(event.srcElement.value.match(/(.[jJ][pP][eE]?[gG]|.[gG][iI][fF]|.[pP][nN][gG])/)) {
document.all['coverstory_img'].className='upbg3';
cs_img.src = img;
setTimeout('checkImgSize()', 500);
} else {
update.value=0;
cs_img.src="http://img.yahoo.co.kr/club/club/cover/img_cover_photo.gif";
alert("업로드 할 수 없는 파일 형식입니다");
}

}
function checkImgSize() {
var cs_img = document.all.coverstory_img;
var yahooimg = document.varform.yahooimg;
var userimg = document.varform.userimg;
var update = document.varform.update;

if ( cs_img.fileSize > 100 * 1024 ) {
alert("100K 이상의 이미지는 업로드 할 수 없습니다.");
cs_img.src = "http://img.yahoo.co.kr/club/club/cover/img_cover_photo.gif";
update.value = 0;
return false;
}
return true;

}

-->
</script>

<form name="varform" method=post action="/king/COVERSTORY/edit.html" ENCTYPE='multipart/form-data'>
<img src="http://img.yahoo.co.kr/club/club/cover/img_cover_photo.gif" width="269" height="196" name="coverstory_img" class=kk>
<br>
<input type="file" name="img" onChange="imgChange(document.varform.img.value)">
</form>
<ul style=color:#ff9933;font-weight:bold;font-size:12pt>
<li>이미지 실시간으로 보여주기
<li>이미지 용량 체크해주기
<li>이미지 넣는 순간 스타일 바꿔 적용하기
</ul>
Posted by 알 수 없는 사용자
,
<script>
function checkNoKr(e)
{
var objTarget = e.srcElement || e.target;
if(objTarget.type == 'text')
{
var value = objTarget.value;
if(/[ㄱ-ㅎㅏ-ㅡ가-핳]/.test(value))
{
alert('한글은 사용하실 수 없읍니다.');
objTarget.value = objTarget.value.replace(/[ㄱ-ㅎㅏ-ㅡ가-핳]/g,''); // g가 핵심: 빠르게 타이핑할때 여러 한글문자가 입력되어 버린다.
}
}


}
</script>

<input type="text" onkeyup="checkNoKr(event)" />
Posted by 알 수 없는 사용자
,
<script>
function checkNoEn(e)
{
var objTarget = e.srcElement || e.target;
if(objTarget.type == 'text')
{
var value = objTarget.value;
if(/[a-zA-Z]/.test(value))
{
alert('영문은 사용하실 수 없읍니다.');
objTarget.value = objTarget.value.replace(/[a-zA-Z]/g,''); // g가 핵심: 빠르게 타이핑할때 여러 영문자가 입력되어 버린다.
}
}


}
</script>

<input type="text" onkeyup="checkNoEn(event)" />
Posted by 알 수 없는 사용자
,
<script language='javascript'>
function popup(){
window.open('http://kr.yahoo.com','','');
self.opener = self;
self.close();
}
</script>
<input type=button value='ok' onclick=popup()>
Posted by 알 수 없는 사용자
,

<img src=aaaa.gif onerror="this.style.visibility='hidden'">

만약에 aaaa.gif 파일이 존재하지 않으면 감춘다.
그렇게함으로써 이미지가 x로 표시되는걸 막아준다.


보통 여러군데에 창고?를 두고 이미지를 링크해서 사용할때...
원본 이미지의 링크가 깨지게되면 X표의 이미지들을 볼수 있습니다.
그걸 방지하는 소스입니다.

<img onerror="this.src='에러발생이미지';" src="원본이미지" width="180" height="253" border="0">

위와같이 소스를 적어주면 만약 '원본이미지'가 존재하지 않는다면 그위치에 '에러발생이미지'를 출력해 줍니다..^^;


Posted by 알 수 없는 사용자
,
<style media="screen">

.myD{display:none;}

</style>


<div class="myD">Print Show</div> <!-- 프린트시 출력-->


프린트할때 출력되지 않게 하기
Print None
Posted by 알 수 없는 사용자
,
<script>
// F11_key, F5_key, Ctrl_key등 비활성화 스크립트

function processKey()
{
if( (event.ctrlKey == true && (event.keyCode == 78 || event.keyCode == 82)) ||
(event.keyCode >= 112 && event.keyCode <= 123))
{
event.keyCode = 0;
event.cancelBubble = true;
event.returnValue = false;
}
}

document.onkeydown = processKey
</script>
Posted by 알 수 없는 사용자
,
<a href="javascript:tomail('아뒤','서버');>메일보내기</a>

<SCRIPT LANGUAGE="JavaScript">
<!--
function tomail(id,server){
location.href="mailto:"+id+"@"+server;
}
//-->
</SCRIPT>
Posted by 알 수 없는 사용자
,
시리얼번호가 있는 프로그램을 설치할때...
[ ] - [ ] - [ ] - [ ]
위와 같은 식으로 폼이 나뉘어져 있고...
AAAA-BBBB-CCCC-DDDD
이런식의 시리얼번호를 복사해서 바로 붙이기 하면 한번에 폼안에 들어가는 경우가 있습니다.

웹에서도 마찬가지로 사업자번호와 같은 것을 복사하고 붙이고자 하는 경우가 있는데...
위와 같이 각기 나뉘어진 폼이라면 한번에 붙이가 되진 않겠죠...

그래서 아래와 같은 소스를 만들어 보았는데요...

붙이기 이벤트가 일어나면 복사되어있는 문자들을 가져다가 폼에 순서대로 붙여 주는 형태 입니다.



<form name=reg>
<input type=text name=a size=3 maxlength=3 onPaste="catchPaste(this.form);event.returnValue=false">
-
<input type=text name=b size=2 maxlength=2>
-
<input type=text name=c size=5 maxlength=5>
</form>

<textarea style=visibility:hidden id=temp></textarea>

<script>
function catchPaste(obj)
{
var cnt=0;

temp.innerHTML='';
obj.a.value='';
obj.b.value='';
obj.c.value='';

var doc=document.body.createTextRange();
doc.moveToElementText(document.all('temp'));
doc.execCommand('paste');

source=temp.innerHTML;

for(var i=0; i<source.length; i++)
{
sourceChar = source.substr(i,1);

if(sourceChar=='-')
{
continue;
}

if(cnt<3)
{
obj.a.value+=sourceChar;
}
else if(cnt<5)
{
obj.b.value+=sourceChar;
}
else if(cnt<10)
{
obj.c.value+=sourceChar;
}
else
{
return;
}

cnt++;
}
}
</script>
Posted by 알 수 없는 사용자
,
<!-- 부모창 내용 -->
<script>window.name="main"</script>
<a href="javascript:window.open('popup.htm','','width=400 height=400');">팝업</a>

오픈하기 전에 부모창의 window 이름을 입력


<!-- 자식창 내용 -->

<form name=f action=main2.htm target="main">
이름 : <input type=text name=name><br>
<input type=submit value="전송">
</form>

target 을 부모창이름으로 설정
Posted by 알 수 없는 사용자
,
<script>
function gogo(){
    f = document.f1;

    if(isNaN(f.xx.value)){
        alert('숫자만 입력바랍니다.');
        f.xx.value='';
        f.xx.focus();
    }else{
        alert('숫자만 입력하셨군요. 착하셔라^^;');
    }
}
</script>


숫자입력을 확인하는 스크립트

<form name=f1>
<input type=text name=xx> <input type=button value='Only 숫자인지 체크' onclick=gogo();>
</form>



다른거...

<script>
function num_chk(num) {
    if(isNaN(num.value)) {
        alert('숫자만 입력하세요');
        num.value = "";
        num.focus();
        return;
    }
}
</script>

<input type="text" name="aaa" onkeyup="num_chk(this)">
Posted by 알 수 없는 사용자
,
<Script language=javascript>
function numberCheck(target) {        // 숫자만 입력받도록
        if (target.value.length == 0) {
                return true;
        }
        var digit = "1234567890";
        var i;
        var t = target.value;
        for(i=0; i<t.length; i++) {
                if(digit.indexOf(t.substring(i,i+1)) < 0) {
                        alert("숫자로만 입력해 주세요.");
                        var temp = "";
                        for(i=0; i<t.length; i++) {
                                if(digit.indexOf(t.substring(i,i+1)) >= 0) {
                                        temp = temp + t.substring(i,i+1);
                                }
                        }
                        target.value = temp;
                        return false;
                }
        }
        return true;
}

function onTooltip(target,tooltip) {
        var E = window.event;
        var temp = target.value;
        var tag = "원십백천만십백천억십백천조십백천경";
        var result = "";
        var i,j;
        var tempSub;
        for(i=0; i<temp.length; i++) {
                tempSub = temp.substring(temp.length - 1 - i, temp.length - i);
                if (tempSub != "0") result = tempSub + tag.substring(i,i+1) + result;
                else if (i == 0) {
                        result = tag.substring(i,i+1) + result;
                }
                else if ( ((i%4) == "0") && ((i+1) != temp.length) ) {
                        for (j=1;j<4;j++) {
                                if (temp.length - 1 - i - j >= 0) {
                                        if ( temp.substring(temp.length - 1 - i - j, temp.length - i - j) != "0" ) {
                                                result = tag.substring(i,i+1) + result;
                                                j = 4;
                                        }
                                }
                        }
                }
        }
        tooltip.style.width = result.length * 9 + 20;
        tooltip.style.visibility = "visible";  // 툴팁 보이기
        tooltip.innerHTML = result;
}

function offTooltip(tooltip) {
        tooltip.style.visibility = "hidden";  // 툴팁 감추기
}

</Script>

<input onkeyup='numberCheck(this);onTooltip(this,tooltip1);' onblur='offTooltip(tooltip1);'>

<div id='tooltip1' class='tipDiv' style='position:absolute;top:19px;left:20px;padding:3px;visibility:hidden;z-index:20;font-family:Verdana;font-size:8pt;background:#333333;border:1px solid #000000;color:#FFcc00;'>툴팁표시</div>
Posted by 알 수 없는 사용자
,
<HTML>
<HEAD>
<TITLE>슬라이딩 메뉴(출처-mygony.com)</TITLE>
<style>
BODY { font-size:9pt; }
.menu {
    border:1px solid #CCCCCC;
    background-color:#DEDEDE;
    padding:3px 1px 1px 5px;
    width:150px;
    cursor:pointer;
}
.submenu {
    width:150px;
    padding-left:10px;
    display:none;
    cursor:pointer;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function slide(Id, interval, to)
{
    var obj = document.getElementById(Id);
    var H, step = 5;

    if (obj == null) return;
    if (to == undefined) { // user clicking

        if (obj._slideStart == true) return;
        if (obj._expand == true) {
            to = 0;
            obj.style.overflow = "hidden";
        } else {
            slide.addId(Id);
            for(var i=0; i < slide.objects.length; i++) {
                if (slide.objects[i].id != Id && slide.objects[i]._expand == true) {
                    slide(slide.objects[i].id);
                }
            }

            obj.style.height = "";
            obj.style.overflow = "";
            obj.style.display = "block";
            to = obj.offsetHeight;
            obj.style.overflow = "hidden";
            obj.style.height = "1px";
        }
        obj._slideStart = true;
    }
   
    step            = ((to > 0) ? 1:-1) * step;
    interval        = ((interval==undefined)?1:interval);
    obj.style.height = (H=((H=(isNaN(H=parseInt(obj.style.height))?0:H))+step<0)?0:H+step)+"px";
   
    if (H <= 0) {
        obj.style.display = "none";
        obj.style.overflow = "hidden";
        obj._expand = false;
        obj._slideStart = false;
    } else if (to > 0 && H >= to) {
        obj.style.display = "block";
        obj.style.overflow = "visible";
        obj.style.height = H + "px";
        obj._expand = true;
        obj._slideStart = false;
    } else {
        setTimeout("slide('"+Id+"' , "+interval+", "+to+");", interval);
    }
}
slide.objects = new Array();
slide.addId = function(Id)
{
    for (var i=0; i < slide.objects.length; i++) {
        if (slide.objects[i].id == Id) return true;
    }
    slide.objects[slide.objects.length] = document.getElementById(Id);
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<div class="menu" onClick="slide('sub1');">Tree1</div>
<div id="sub1" class="submenu">
    <div>  + SubTree1-1</div>
    <div>  + SubTree1-2</div>
    <div>  + SubTree1-3</div>
    <div>  + SubTree1-4</div>
    <div>  + SubTree1-5</div>
</div>
<div class="menu" onClick="slide('sub2');">Tree2</div>
<div id="sub2" class="submenu">
    <div>  + SubTree2-1</div>
    <div>  + SubTree2-2</div>
    <div>  + SubTree2-3</div>
    <div>  + SubTree2-4</div>
</div>
<div class="menu" onClick="slide('sub3');">Tree3</div>
<div id="sub3" class="submenu">
    <div>  + SubTree3-1</div>
    <div>  + SubTree3-2</div>
    <div>  + SubTree3-3</div>
</div>
<div class="menu">이건 다른 메뉴</div>
</BODY>
</HTML>
Posted by 알 수 없는 사용자
,
<table id=tWidth border=1 cellpatWidthing=5 cellspacing=5>
<tr bgcolor=yellow>
        <td><input type=button value="늘이기" onClick=plus()></td>
        <td><input type=button value="줄이기" onClick=minus()></td>
</tr>
</table>
<p>
<input type=button value="기본값" onClick=basic()>
.
<SCRIPT LANGUAGE="JavaScript">
<!--
/*
=====================================
이곳이 초기값 설정하는 부분입니다.
최소값은 기본값보다 100px이 작습니다.
=====================================
*/

var dSize = Number(300); // 기본값
var pSize = Number(20); // 더하고 빠지는 값
var size = Number(0);

if (getCookie("HOMESIZE"))
{
        size = Number(getCookie("HOMESIZE"))
        document.getElementById("tWidth").width = size
}
else
{
        size = dSize
        document.getElementById("tWidth").width = dSize
}

function basic() // 기본값
{          
        size = document.getElementById("tWidth").width = dSize
        deleteCookie("HOMESIZE")
}

function plus() // 늘리기
{
        size = size + pSize
        document.getElementById("tWidth").width = size
        userCookie("HOMESIZE",size,365)
}

function minus() // 줄이기
{
        if ( size > (dSize-100) ){
                size = size - pSize
                document.getElementById("tWidth").width = size
                userCookie("HOMESIZE",size,365)
        }
        else
        {
                alert ("집이 너무 작아집니다.. -_-");
        }
}

function deleteCookie(name)
{
        var expires = new Date();
        var value = getCookie(name);
        if(value)   {
                document.cookie = name + "=" + value + "; expires=" + expires.toGMTString();
        }
}

function userCookie(name,value,expire)   {
        str = '';
        str =  name + "=" + value + ( (expire) ? "; expires=" + makeGMT(expire) : "") ;
        document.cookie = str;
}

function makeGMT(stay_time)   {
        _time = new Date();
        _time.setTime(_time.getTime() + 60 * 60 * 1000 * stay_time);
        return _time.toGMTString();
}

function getCookie(wan_str)  {  
        var cs = document.cookie;  
        var prefix = wan_str + "=" ;  
        var cSI = cs.indexOf(prefix);  
        if (cSI == -1) return null;  
        else  {  
        var cEI = cs.indexOf(";", cSI + prefix.length);  
        if (cEI == -1)  ret_str =  cs.slice(cSI + prefix.length, cs.length);  
        else    ret_str = cs.slice(cSI + prefix.length, cEI);  
        }  
        return ret_str;
}

// onload = basic;

//-->
</SCRIPT>
Posted by 알 수 없는 사용자
,
<style>
a.rollover img { border-width:0px; display:inline; }
a.rollover img.over { display:none; }
a.rollover:hover { border:0px }
a.rollover:hover img { display:none; }
a.rollover:hover img.over { display:inline; }
</style>

<BODY>
<a href="#test" class="rollover"><img src="http://gony.home.uos.ac.kr/GTO_004.gif"><img src="http://gony.home.uos.ac.kr/GTO_005.gif" class="over"></a>
<a href="#test" class="rollover"><img src="http://gony.home.uos.ac.kr/GTE_019.gif"><img src="http://gony.home.uos.ac.kr/GTO_007.gif" class="over"></a>
</BODY>
Posted by 알 수 없는 사용자
,
<script>
function top_round(w,c) {
var top_html;
top_html="<table cellpadding=0 cellspacing=0 border=0 width="+w+">";
top_html+="<tr height=1><td rowspan=4 width=1></td><td rowspan=3 width=1></td>";
top_html+="<td rowspan=2 width=1></td><td width=2></td><td bgcolor="+c+"></td>";
top_html+="<td width=2></td><td rowspan=2 width=1></td><td rowspan=3 width=1></td>";
top_html+="<td rowspan=4 width=1></td></tr><tr height=1><td bgcolor="+c+"></td>";
top_html+="<td bgcolor="+c+"></td><td bgcolor="+c+"></td></tr>";
top_html+="<tr height=1><td bgcolor="+c+"></td><td colspan=3 bgcolor="+c+"></td>";
top_html+="<td bgcolor="+c+"></td></tr><tr height=2><td bgcolor="+c+"></td>";
top_html+="<td colspan=5 bgcolor="+c+"></td><td bgcolor="+c+"></td></tr></table>";
document.write(top_html);
}

function bottom_round(w,c) {
var bottom_html;
bottom_html="<table cellpadding=0 cellspacing=0 border=0 width="+w+">";
bottom_html+="<tr height=2><td rowspan=4 width=1></td><td width=1 bgcolor="+c+"></td><td width=1 bgcolor="+c+"></td>";
bottom_html+="<td width=2 bgcolor="+c+"></td><td bgcolor="+c+"></td><td width=2 bgcolor="+c+"></td>";
bottom_html+="<td width=1 bgcolor="+c+"></td><td width=1 bgcolor="+c+"></td><td rowspan=4 width=1></td></tr>";
bottom_html+="<tr height=1><td rowspan=3></td><td bgcolor="+c+"></td><td colspan=3 bgcolor="+c+"></td>";
bottom_html+="<td bgcolor="+c+"></td><td rowspan=3></td>  </tr><tr height=1><td rowspan=2></td>";
bottom_html+="<td bgcolor="+c+"></td><td bgcolor="+c+"></td><td bgcolor="+c+"></td><td rowspan=2></td></tr>";
bottom_html+="<tr height=1><td></td><td bgcolor="+c+"></td><td></td></tr></table>";
document.write(bottom_html);
}
</script>  
<!---     top_round("테이블넓이","테이블색상");
             테이블 넓이는 퍼센트로도 됩니다.            --->
<script>top_round("100%","#EEE0EC");</script>
<table border=0 width=100% bgcolor=#EEE0EC cellpadding=0 cellspacing=0>
<tr><td style="padding:3 7 0 7;">내용</td></tr>
</table>
<script>bottom_round("100%","#EEE0EC");</script>
Posted by 알 수 없는 사용자
,
<script language="JavaScript1.2">
<!--
function win640() { window.resizeTo (640,480) }
function win800() { window.resizeTo (800,600) }
function win1024() { window.resizeTo (1024,768) }
function win1152() { window.resizeTo (1152,864) }
function win1280a() { window.resizeTo (1280,960) }
function win1280b() { window.resizeTo (1280,1024) }
function win1600a() { window.resizeTo (1600,1200) }
function win1600b() { window.resizeTo (1600,1280) }
function win1792() { window.resizeTo (1792,1344) }
function win1800() { window.resizeTo (1800,1440) }
function win1856() { window.resizeTo (1856,1392) }
function win1920() { window.resizeTo (1920,1440) }
function win2432() { window.resizeTo (2432,1080) }
function move() { window.moveTo (0,0) }
//-->
</script>



<a href=javascript:win640();>640X480</a> (14in)<br>
<a href=javascript:win800();>800X600</a> (15in)<br>
<a href=javascript:win1024();>1024X768</a> (17in)<br>
<a href=javascript:win1152();>1152X864</a> (19in)<br>
<a href=javascript:win1280a();>1280X960</a> (20in)<br>
<a href=javascript:win1280b();>1280X1024</a> <br>
<a href=javascript:win1600a();>1600X1200</a><br>
<a href=javascript:win1600b();>1600X1280</a><br>
<a href=javascript:win1792();>1792X1344</a><br>
<a href=javascript:win1800();>1800X1440</a><br>
<a href=javascript:win1856();>1856X1392</a><br>
<a href=javascript:win1920();>1920X1440</a><br>
<a href=javascript:win2432();>2432X1080</a><br>
<a href=javascript:move();>to left-top</a>
Posted by 알 수 없는 사용자
,
첫번째 방법(자동)
<script language="javascript">
function setLine( txa ){
  line = 7 //기본 줄 수
  new_line = txa.value.split( "\n" ).length + 1;
  if( new_line < line ) new_line = line;
  txa.rows = new_line;
}
</script>
<textarea name="memo" scol rows=7 onKeyDown="setLine( this )" style='overflow-y:auto; overflow-x:hidden; width:100%;'> </textarea>



두번째 방법(자동)
<textarea name="memo" style="width:100%;height:100;border:1 solid #E3E3E3;overflow:visible;text-overflow:ellipsis;"> </textarea>



세번째 방법(수동)
<SCRIPT>
var timer_id = null;
var timer_min = 100;                // 타이머 최소 시간 간격 ( 이 간격이하로는 더 줄지 않습니다 )
var timer_max = 300;                // 타이머 최대 시간 간격
var timer_interval = timer_max;        // 타이머 시간 간격 (msec)
var timer_interval_desc = 50;        // 타이머 시간 간격 감소량 (mes)  ( 가속을 흉내내려고 -_-;;;;; )
var min_rows = 7;                // 최소 줄수
var max_rows = 25;                // 최대 줄수

function enlarge( obj, delta )
{
        obj = (typeof obj == "string" ? document.getElementById(obj) : obj);
        if (obj.rows + delta <= min_rows ) {
                obj.rows = min_rows;
                return;
        } else         if (obj.rows + delta >= max_rows ) {
                obj.rows = max_rows;
                return;
        }
        else obj.rows = obj.rows + delta;

        if (timer_interval > timer_min) timer_interval = timer_interval - timer_interval_desc;
        timer_id = setTimeout( "enlarge('" + obj.id + "', " + delta + ");", timer_interval );
}

function enlarge_stop( obj )
{
        timer_interval = timer_max;
        clearTimeout(timer_id);
}
</SCRIPT>
<TABLE>
<TR>
<TD style="vertical-align:top;padding-top:3px;padding-bottom:3px;font-size:9pt" align=right>
<IMG src="btn_up.gif" onmousedown="enlarge('contents',-2);" onmouseup="enlarge_stop('contents');" onmouseout="enlarge_stop('contents');" vspace=2> <BR>
<IMG src="btn_down.gif" onmousedown="enlarge('contents',+2);" onmouseup="enlarge_stop('contents');" onmouseout="enlarge_stop('contents');" vspace=2>  
</TD>
<TD style="vertical-align:top;padding-top:3px;padding-bottom:3px">
<TEXTAREA NAME="contents" ID="contents" ROWS=5 cols=60 style="border:1px solid #c0c0c0"></TEXTAREA><BR>
</TD>
</TR>
</TABLE>

네번째(확장만 됨)
<textarea onKeyup="var a=100; var b=this.scrollHeight;if(b>=a)this.style.pixelHeight=b+6" style='overflow-y:auto; overflow-x:hidden;height:100; width:100%;'></textarea>
Posted by 알 수 없는 사용자
,
일반 적인 textarea
<textarea style="width:100%; height:200;">
aaaaa
bbbbb
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
</textarea>

투명한 textarea
<textarea style="width:100%; height:200; border:0;overflow-x:hidden;overflow-y:hidden;background:clear;">
aaaaa
bbbbb
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
</textarea>


스크롤바 적용시
<textarea style="width:100%; height:50; border:0;background:clear;scrollbar-highlight-color: #A864A8;scrollbar-shadow-color: #A864A8; scrollbar-arrow-color: #A864A8;scrollbar-face-color: #FFFFFF; scrollbar-3dlight-color: #FFFFFF;scrollbar-darkshadow-color: #FFFFFF;scrollbar-track-color: #FFFFFF;">
aaaaa
bbbbb
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
</textarea>
Posted by 알 수 없는 사용자
,
두께를 다르게 적용해도됨니다.

<span style="font-size:9pt; border:solid 0 #9999CC;  border-bottom-width:1;">폰트 스타일 테스트</span> <br>
<span style="font-size:9pt; border:dotted 0 #9999CC; border-bottom-width:1;">폰트 스타일 테스트</span> <br>
<span style="font-size:9pt; border:dashed 0 #9999CC; border-bottom-width:1;">폰트 스타일 테스트</span>

폰트 스타일 테스트
폰트 스타일 테스트
폰트 스타일 테스트
Posted by 알 수 없는 사용자
,

토글 메뉴

인터넷관련 2008. 2. 2. 09:38
<script language="Javascript">
<!-- //////////////////////////////////////////////////////////////
//*****************************************************************
// Web Site: http://www.CginJs.Com
// CGI 와 JavaScript가 만났을 때 = C.n.J ☞ http://www.CginJs.Com
// CGI 와 JavaScript가 만났을 때 = C.n.J ☞ webmaster@CginJs.Com
// C.n.J 자바스크립트 자동 생성 마법사 ☞ http://www.CginJs.Com
// Editer : Web Site: http://www.CginJs.Com
//*****************************************************************
/////////////////////////////////////////////////////////////// -->
//참고로 표에 id 적용시는 와 같이 <tr id='menu추가숫자'> 에 적용하면 됩니다.
//적용 범위는 <tr> ~ </tr> 사이
//일반적으로 적용 할때는 <span id='menu추가숫자'> ~~ </span> 부분이 적용 됩니다.
/*
부가적으로 페이지에 로딩할때 기본적으로 특정 메뉴를 열려면
BODY 부분에 onLoad 이벤트를 사용하면 됩니다.
예를 들어 아래와 같이 4번 메뉴를 기본으로 가지고 오려면..
<body onload="toggleMenu('menu4')">
응용은 사용자에 몫입니다.
*/
// 토글 메뉴
var cnj_lineheigh = '200%'; // 셀안의 글자 라인 간격
document.write('<style>');
document.write('A:link,A:active,A:visited{text-decoration:none;font-size:12PX;color:#333333;}');
document.write('A:hover {text-decoration:none; color:ff9900}');
document.write('#cnj_td { line-height:'+cnj_lineheigh+'; }');
/// 메뉴 추가시 동일해야 함 //////////
document.write('#menu1 {display:none; margin-left:10px}');
document.write('#menu2 {display:none; margin-left:10px}');
document.write('#menu3 {display:none; margin-left:10px}');
document.write('#menu4 {display:none; margin-left:10px}');
/* 추가시
document.write('#menu추가숫자 {display:none; margin-left:10px}');
*/
/// 메뉴 추가시 동일해야 함 //////////
document.write('</style>');
function toggleMenu(currMenu){
if (document.all){
thisMenu = eval('document.all.' + currMenu + '.style')
if (thisMenu.display == 'block') {
document.all.menu1.style.display = 'none'
document.all.menu2.style.display = 'none'
document.all.menu3.style.display = 'none'
document.all.menu4.style.display = 'none'
/* 추가시
document.all.menu추가숫자.style.display = 'none'
*/
thisMenu.display = 'none'
}
else {
document.all.menu1.style.display = 'none'
document.all.menu2.style.display = 'none'
document.all.menu3.style.display = 'none'
document.all.menu4.style.display = 'none'
/* 추가시
document.all.menu추가숫자.style.display = 'none'
*/
thisMenu.display = 'block'
}
return false
}
else {
return true
}
}

function linkblur(){ // 링크에 점선 없애기

if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=linkblur;
document.write('<body>');
</script>

<table width="150" border="0" cellspacing="1" cellpadding="1" bgcolor="#cccccc" id='cnj_td'>
<!-- 주 메뉴1 시작 -->
<tr><td bgcolor="#f2f2f2" height="25"><a href="#" onClick="return toggleMenu('menu1')">C.n.J 메뉴1</a></td></tr>
<!-- 주 메뉴1 끝 -->

<!-- 서브 메뉴1 시작 -->
<tr id='menu1'><td bgcolor='#ffffff'> <a href="http://www.CginJs.Com" target="_blank"><img src='http://www.CginJs.Com/img/cnj-logo-90.gif' border='0'></a></td></tr>
<!-- 서브 메뉴1 끝 -->

<!-- 주 메뉴2 시작 -->
<tr><td bgcolor="#f2f2f2" height="25"><a href="#" onClick="return toggleMenu('menu2')">C.n.J 메뉴2</a></td></tr>
<!-- 주 메뉴2 끝 -->

<!-- 서브 메뉴2 시작 -->
<tr id='menu2'>
<td bgcolor='#ffffff'>
<a href="javascript:;">^ 서브메뉴2-1</a><br>
<a href="javascript:;">^ 서브메뉴2-2</a>
</td>
</tr>
<!-- 서브 메뉴2 끝 -->

<!-- 주 메뉴3 시작 -->
<tr><td bgcolor="#f2f2f2" height="25"><a href="#" onClick="return toggleMenu('menu3')">C.n.J 메뉴3</a></td></tr>
<!-- 주 메뉴3 끝 -->

<!-- 서브 메뉴3 시작 -->
<tr id='menu3'>
<td bgcolor='#ffffff'>
<a href="javascript:;">^ 서브메뉴3-1</a><br>
<a href="javascript:;">^ 서브메뉴3-2</a>
</td>
</tr>
<!-- 서브 메뉴3 끝 -->

<!-- 주 메뉴4 시작 -->
<tr><td bgcolor="#f2f2f2" height="25"><a href="#" onClick="return toggleMenu('menu4')">C.n.J 메뉴4</a></td></tr>
<!-- 주 메뉴4 끝 -->

<!-- 서브 메뉴4 시작 -->
<tr id='menu4'>
<td bgcolor='#ffffff'>
<a href="javascript:;">^ 서브메뉴4-1</a><br>
<a href="javascript:;">^ 서브메뉴4-2</a>
</td>
</tr>
<!-- 서브 메뉴4 끝 -->

<!--
<tr><td bgcolor="#f2f2f2" height="25"><a href="#" onClick="return toggleMenu('menu추가숫자')">C.n.J 메뉴 추가</a></td></tr>

<tr id='menu추가숫자'>
<td bgcolor='#ffffff'>
<a href="javascript:;">^ 추가 서브메뉴 1</a><br>
<a href="javascript:;">^ 추가 서브메뉴 2</a>
</td>
</tr>
참고로 표에 id 적용시는 와 같이 <tr id='menu추가숫자'> 에 적용하면 됩니다.
적용 범위는 <tr> ~ </tr> 사이
일반적으로 적용 할때는 <span id='menu추가숫자'> ~~ </span> 부분이 적용 됩니다.
-->
</table>
Posted by 알 수 없는 사용자
,
<html>
<head>
<script language="javascript">
if ( navigator.appName == "Netscape" )
{
navigator.plugins.refresh();
document.write("<" + "applet MAYSCRIPT Code=NPDS.npDSEvtObsProxy.class" )
document.writeln(" WIDTH=5 HEIGHT=5 NAME=appObs> </applet>")
}
function vol_up(){
volume=MTVPlay.volume;
if (volume==+2500){
return false;
}else{
MTVPlay.volume=volume+250;
volume=MTVPlay.volume;
}
}
function vol_down(){
volume=MTVPlay.volume;
if (volume==-2500){
return false;
}else{
MTVPlay.volume=volume-250;
volume=MTVPlay.volume;
}
}
function muteoff(){
MTVPlay.mute=false;
}
function mute(){
MTVPlay.mute=true;
}
function ff(){
MTVPlay.next();
}
function pre(){
MTVPlay.previous();
}
function replay(){
MTVPlay.playcount=0;
}
function replayoff(){
MTVPlay.playcount=1;
}
function play(){
if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
MTVPlay.Play();
} else {
document.MTVPlay.Play();
}
}
function pause(){
if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
if (MTVPlay.PlayState == 2){
MTVPlay.Pause();
}
else {
if (MTVPlay.PlayState == 1) {
MTVPlay.Play();
}
}
} else {
document.MTVPlay.Pause();
}
}
function stop(){
if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
MTVPlay.Stop();
MTVPlay.CurrentPosition=0;
} else {
document.MTVPlay.Stop();
document.MTVPlay.CurrentPosition=0;
}
}
function muteClick()
{
if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
bMuteState = MTVPlay.Mute;
} else {
bMuteState = MTVPlay.GetMute();
}
if (bMuteState == true) {
MTVPlay.value="Mute";
if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
MTVPlay.Mute = false;
} else {
MTVPlay.SetMute(false);
}
} else {
MTVPlay.value="Un-Mute";
if ((navigator.userAgent.indexOf('IE') > -1) && (navigator.platform == "Win32")) {
MTVPlay.Mute = true;
} else {
MTVPlay
}
}
}
</script>

<script language="javascript">
<!--
function fs(){
MTVPlay.DisplaySize = 3;
MTVPlay.Play();
MTVPlay.focus();
}
//-->
</script>
</head>
<body>
<object id=MTVPlay width=285 height=233 classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" VIEWASTEXT>
<param name="Filename" value="동영상파일이름(경로)">
<param name="ShowControls" value="0">
</object>
<br>
<a href=# onClick="play()">재생</a><br>
<a href=# onClick="pause()">일시정지</a><br>
<a href=# onClick="stop()">정지</a><br>
<a href=# onClick="replayoff()">반복취소</a><br>
<a href=# onClick="replay()">반복</a><br>
<a href=# onClick="fs()">전체화면</a><br>
<a href=# onClick="muteClick()">소리죽이기</a><br>
<a href=# onClick="vol_down()">소리낮춤</a><br>
<a href=# onClick="vol_up()">소리높임</a><br>
</body>
</html>

'인터넷관련' 카테고리의 다른 글

글쓰기폼 늘리기 - 확장, 축소  (0) 2008.02.02
투명한 textarea  (0) 2008.02.02
텍스트 밑줄 긋기  (0) 2008.02.02
토글 메뉴  (0) 2008.02.02
이미지 안쓰고 모서리(테두리) 둥근 테이블 만들기  (0) 2008.02.02
스포트라이트 효과  (0) 2008.02.02
PNG 그림파일 알파값 살리기  (0) 2008.02.02
팝업창에 관한 모든것(새창)  (0) 2008.02.02
Posted by 알 수 없는 사용자
,
<script>
function roundTable(objID) {
       var obj = document.getElementById(objID);
       var Parent, objTmp, Table, TBody, TR, TD;
       var bdcolor, bgcolor, Space;
       var trIDX, tdIDX, MAX;
       var styleWidth, styleHeight;

       // get parent node
       Parent = obj.parentNode;
       objTmp = document.createElement('SPAN');
       Parent.insertBefore(objTmp, obj);
       Parent.removeChild(obj);

       // get attribute
       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;
      
       /*
              create table {{
       */
       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);
      
       // insert table and remove original table
       Parent.insertBefore(Table, objTmp);
}
</script>

사용법)
테이블에 아이디태그가 있어야 합니다.
전 한번 변환하는게 몇개 안되어서 아이디를 입력받아 함수를 실행하도록 했지만, 만약 많은 양을 한꺼번에 변환해야할 경우에는 함수를 변경해서 사용하시기 바랍니다. ^^

위 스크립트를 HTML문서에 포함하고(당연히...),
roundTable(테이블의 아이디문자열);
처럼 함수를 실행시키시면 됩니다.
단, 이 때 원래의 테이블에서 raidus(둥근 정도) 값과 테두리와 배경색의 색상값을 지정하도록 되어있습니다.

int radius : 둥근 정도입니다. 가능한 값은 1 <= radius<= 6 입니다. radius 를 계산하는 부분의 규칙을 잘 몰라서 우선은 한정시켜놨습니다. 나중에 모서리 픽셀을 제대로 구할 수 있게 되면 범위를 수정하겠습니다.

string rborder : 테두리의 색상값. #FFFFFF 와 같은 16진수 색상값과 white 와 같은 색상지시문자열 모두 사용가능.
string rbgcolor : 라운드테이블의 배경색. 배경색은 라운드 테이블 테두리 선 안쪽의 색상을 말하는 것입니다. rborder와 마찬가지로 16진수 색상값과 색상지시문자열 모두 사용가능합니다.

예)
<table id="ta" width="300" height="150" border="0" radius="3" rborder="#999999" rbgcolor="#F8F8F8">
<tr>
       <td>1</td>
       <td>1</td>
</tr>
<tr>
       <td colspan="2">테스트</td>
</tr>
</table>
<script>roundTable("ta");</script>

자세한 것은 링크를 참조하시면 됩니다.

출처 http://www.phpschool.com/bbs2/inc_view.html?id=9751&code=tnt2&start=360&mode=&field=&search_name=&operator=&period=&category_id=&s_que=

'인터넷관련' 카테고리의 다른 글

투명한 textarea  (0) 2008.02.02
텍스트 밑줄 긋기  (0) 2008.02.02
토글 메뉴  (0) 2008.02.02
웹페이지에 삽입된 동영상 및 음악 제어  (0) 2008.02.02
스포트라이트 효과  (0) 2008.02.02
PNG 그림파일 알파값 살리기  (0) 2008.02.02
팝업창에 관한 모든것(새창)  (0) 2008.02.02
필터 효과  (0) 2008.02.02
Posted by 알 수 없는 사용자
,
<style>
#myimage{
filter:light
}
</style>



<center>
- 스포트라이트 효과 -
<br>
<br>
<img id="myimage" src="http://oxtag.com/zboard/data/gallery/baby_4.jpg">
<script language="JavaScript1.2">

s = 50; //스포트라이트의 크기
vp = 10; // 보여질 비율(%)
startx = 0; // 시작시 스포트라이트의 위쪽 위치
starty = 0; // 시작시 스포트라이트의 왼쪽 위치

var IE = document.all?true:false

function moveL()
{
xv = tempX;
yv = tempY;
myimage.filters.light.MoveLight(1,xv,yv,s,true);
}

if (IE&&myimage.filters)
document.all.myimage.onmousemove = getMouseXY;
var tempX = 0
var tempY = 0


function getMouseXY(e) {
tempX = event.offsetX
tempY = event.offsetY

  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}
  if (t)
  { 
   moveL();
  }

  return true
}

var xv = startx;
var yv = starty;
var t= true;
if (IE&&myimage.filters){
myimage.style.cursor="hand";
myimage.filters.light.addAmbient(255,255,255,vp)
myimage.filters.light.addPoint(startx,starty,s,255,255,255,255)
}

</script>
<br>
<br>이미지위에 마우스 커서를 올려놓고 움직여 보세여<br><center>
Posted by 알 수 없는 사용자
,
<HTML>
<HEAD>
<TITLE> PNG 이미지 알파값 살리기 </TITLE>
<STYLE TYPE="text/css" TITLE="">
.png24 {tmp:expression(setPng24(this));}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<img class="png24" src="test.png">
</BODY>
</HTML>
Posted by 알 수 없는 사용자
,
기본형

1. 옵션을 HEAD안에...
<script language="JavaScript">
function openNewWindow(window) {
open (window,"NewWindow","left=0, top=0, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, width=200, height=200");
}
</script>
<a href=javascript:openNewWindow("주소입력")>새창열기</a>

2. 링크에 옵션을 지정...
<a href="javascript:;" onclick="window.open('주소입력','name','resizable=no width=200 height=200');return false">새창열기</a>

* 옵션 *
새창 뛰울때 용도에 맞게 옵션 설정을 해줍니다. "YES" 또는 "NO" 로 지정 해주면 됩니다.
menubar - 파일, 편집, 보기....부분
toolbar - 뒤로, 앞으로, 새로고침 아이콘등이 있는 부분
directories - 연결 디렉토리가 표시되는 부분
location - 주소 입력창
status - 아래 브라우저 상태 바
scrollbars - 스크롤
resizable - 리사이즈 옵션




1.자동 띄우기

팝업창에 삽입
<html>
<head>
<title></title>
<script language="javascript">
<!--
function pop(){
window.open("팝업창파일", "pop", "width=400,height=500,history=no,resizable=no,status=no,scrollbars=yes,menubar=no")
}
//-->
</script>
</head>
<body onload="javascript:pop()">
이벤트 팝업창을 띄우기
</body>
</html>  


2.프레임이 있는 팝업창 닫기

팝업창에 삽입
<html>
<head>
<title></title>
<script language="Javascript">
<!--
function frameclose() {
parent.close()
window.close()
self.close()
}
//-->
</script>
</head>
<body>
<a href="javascript:frameclose()">프레임셋 한방에 닫기</a>
</body>
</html>


3.팝업창 닫고 프레임이 없는 부모창에서 원하는 페이지로 이동하기

팝업창에 삽입
<html>
<head>
<title></title>
<script language="javascript">
<!--
function MovePage() {
window.opener.top.location.href="연결할파일"
window.close()
}
//-->
</script>
</head>
<body>
<a href="javascript:MovePage();">자세한내용보기</a>
</body>
</html>


4.팝업창 닫고 프레임이 있는 부모창에서 원하는 페이지로 이동하기

팝업창에 삽입하고 팝업창의 설정은 프레임셋 페이지에 해야함
오픈창이 아닐경우에는 window.top.프레임이름.location.href="연결할파일" 적용한다
<html>
<head>
<title></title>
<script language="javascript">
<!--
function MovePage() {
window.opener.top.프레임이름.location.href="연결할파일"
//팝업창이 아닌것우..
window.close()
}
//-->
</script>
</head>
<body>
<a href="javascript:MovePage();">자세한내용보기</a>
</body>
</html>


5.팝업창 자동으로 닫기

팝업창에 삽입
<html>
<head>
<title>Close Window Timer</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
<!--
function closeWin(thetime) {
setTimeout("window.close()", thetime); //1000 은 1초를 의미합니다.
}
//-->
</script>
</head>
<body onLoad="closeWin('5000')">
이창은 5초후 자동으로 창이 닫힘니다.<br>
</body>
</html>


6.프레임 나눈 팝업창 한번에 닫기

팝업창에 삽입
<html>
<head>
<title>Close Window Timer</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
<!--
function closeWin(thetime) {
setTimeout("window.close()", thetime); //1000 은 1초를 의미합니다.
}
//-->
</script>
</head>
<body onLoad="closeWin('5000')">
이창은 5초후 자동으로 창이 닫힘니다.<br>
</body>
</html>


7.하루동안 팝업창 띄우지 않기 소스 예제1

부모창인 index.htm에 삽입
<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="javascript">
<!--
function getCookie(name)
{
var Found = false
var start, end
var i = 0
// cookie 문자열 전체를 검색
while(i <= document.cookie.length)
{
start = i
end = start + name.length
// name과 동일한 문자가 있다면
if(document.cookie.substring(start, end) == name)
{
Found = true
break
}
i++
}
// name 문자열을 cookie에서 찾았다면
if(Found == true) {
start = end + 1
end = document.cookie.indexOf(";", start)
// 마지막 부분이라 는 것을 의미(마지막에는 ";"가 없다)
if(end < start)
end = document.cookie.length
// name에 해당하는 value값을 추출하여 리턴한다.
return document.cookie.substring(start, end)
}
// 찾지 못했다면
return ""
}
function openMsgBox()
{
var eventCookie=getCookie("memo");
if (eventCookie != "no")
window.open('팝업창파일','_blank','width=300,height=300,top=50,left=150');
//팝업창의 주소, 같은 도메인에 있어야 한다.
}
openMsgBox();
//-->
</script>
</head>
<body>
</body>
</html>



팝업창인 pop.htm에 삽입
<html>
<head>
<title></title>
<head>
<script language="JavaScript">
<!--
function setCookie( name, value, expiredays )
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin()
{
if ( document.myform.event.checked )
setCookie("memo", "no" , 1); // 1일 간 쿠키적용

}
//-->
</script>
</head>
<body onunload="closeWin()">
<form name="myform">
<A onclick="javascript:document.all.event.checked=true;closeWin();window.opener.document.location.href='event.html';" href="#None">
<IMG src="event.gif" border=0>
</A>
<input type="checkbox" name="event">다음부터 이 창을 열지않음
<input type=button value="닫기" onclick="self.close()">
</form>
</body>
</html>



8.하루동안 팝업창 띄우지 않기 소스 예제2

부모창인 index.htm에 삽입
<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function change(form)
{
if (form.url.selectedIndex !=0)
parent.location = form.url.options[form.url.selectedIndex].value
}
function setCookie( name, value, expiredays )
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function getCookie( name )
{
var nameOfCookie = name + "=";
var x = 0;
while ( x <= document.cookie.length )
{
var y = (x+nameOfCookie.length);
if ( document.cookie.substring( x, y ) == nameOfCookie ) {
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
endOfCookie = document.cookie.length;
return unescape( document.cookie.substring( y, endOfCookie ) );
}
x = document.cookie.indexOf( " ", x ) + 1;
if ( x == 0 )
break;
}
return "";
}
if ( getCookie( "Notice" ) != "done" )
{
noticeWindow = window.open('pop.htm','notice','toolbar=no,location=no,directories=no,status=no,
menubar=no,scrollbars=no, resizable=no,width=400,height=400');
//winddow.open의 ()의 것은 한줄에 계속 붙여써야 오류가 안남, 줄바뀌면 오류남
noticeWindow.opener = self;
}
//-->
</script>
</head>
<body>
</body>
</html>



팝업창인 pop.htm에 삽입
<html>
<head>
<title></title>
<head>
<SCRIPT language="JavaScript">
<!--
function setCookie( name, value, expiredays )
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}



function closeWin()
{
if ( document.forms[0].Notice.checked )
setCookie( "Notice", "done" , 1);
self.close();
}
//-->
</script>
</head>
<body onunload="closeWin()">
<form>
<A onclick="javascript:document.all.Notice.checked=true;closeWin();window.opener.document.location.href='event.html';" href="#None">
<IMG src="event.gif" border=0>
</A>
<input type=CHECKBOX name="Notice" value="">다시 팝업 안뜸
<a href="javascript:window.close()">닫기</a>
</form>
</body>
</html>


9.같은 브라우져에서 팝업 띄우기 않기

부모창인 index.htm에 삽입
<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="javascript">
<!--
function getCookie(name)
{
var Found = false
var start, end
var i = 0
// cookie 문자열 전체를 검색
while(i <= document.cookie.length)
{
start = i
end = start + name.length
// name과 동일한 문자가 있다면
if(document.cookie.substring(start, end) == name)
{
Found = true
break
}
i++
}
// name 문자열을 cookie에서 찾았다면
if(Found == true) {
start = end + 1
end = document.cookie.indexOf(";", start)
// 마지막 부분이라 는 것을 의미(마지막에는 ";"가 없다)
if(end < start)
end = document.cookie.length
// name에 해당하는 value값을 추출하여 리턴한다.
return document.cookie.substring(start, end)
}
// 찾지 못했다면
return ""
}
function openMsgBox()
{
var eventCookie=getCookie("memo");
if (eventCookie != "no")
window.open('팝업창파일','_blank','width=300,height=300,top=50,left=150');
//팝업창의 주소, 같은 도메인에 있어야 한다.
}
openMsgBox();
//-->
</script>
</head>
<body>
</body>
</html>


팝업창인 pop.htm에 삽입
<html>
<head>
<title></title>
<head>
<script language="JavaScript">
<!--
function setCookie( name, value, expiredays )
{
//같은 창에서만 안띄움.
//expiredays 값은 상관없음.
document.cookie = name + "=" + escape( value ) + "; path=/;";
function closeWin()
{
if ( document.myform.event.checked )
setCookie("memo", "no" , 1); // 1일 간 쿠키적용

}
//-->
</script>
</head>
<body onunload="closeWin()">
<form name="myform">
<A onclick="javascript:document.all.event.checked=true;closeWin();window.opener.document.location.href='event.html';" href="#None">
<IMG src="event.gif" border=0>
</A>
<input type="checkbox" name="event">다음부터 이 창을 열지않음
<input type=button value="닫기" onclick="self.close()">
</form>
</body>
</html>


10.팝업창 가운데에 자동띄우기

팝업창에 삽입
<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
<!--
function winCentre() {
if (document.layers) {
var sinist = screen.width / 2 - outerWidth / 2;
var toppo = screen.height / 2 - outerHeight / 2;
} else {
var sinist = screen.width / 2 - document.body.offsetWidth / 2;
var toppo = -75 + screen.height / 2 - document.body.offsetHeight / 2;
}
self.moveTo(sinist, toppo);
}
//-->
</script>
</head>
<body onLoad="winCentre()">
</body>
</html>  


11.부모창에서 클릭하면 팝업창 가운데에 띄우기

부모창에 삽입
<html>
<head>
<title></title>
<head>
<script language="JavaScript">
<!--
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',
resizable'
win = window.open(mypage,myname,settings)
}
//-->
</script>
<body>
<a href="팝업창파일" onclick="NewWindow(this,'name','100','100','yes');return false">
링크</a>
</body>
</html>


12.같은 브라우져에서만 팝업 띄우기 않기

부모창인 index.htm에 삽입 _새로 브라우져를 열면 팝업창이 뜸
<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="javascript">
<!--
function getCookie(name)
{
var Found = false
var start, end
var i = 0
// cookie 문자열 전체를 검색
while(i <= document.cookie.length)
{
start = i
end = start + name.length
// name과 동일한 문자가 있다면
if(document.cookie.substring(start, end) == name)
{
Found = true
break
}
i++
}
// name 문자열을 cookie에서 찾았다면
if(Found == true) {
start = end + 1
end = document.cookie.indexOf(";", start)
// 마지막 부분이라 는 것을 의미(마지막에는 ";"가 없다)
if(end < start)
end = document.cookie.length
// name에 해당하는 value값을 추출하여 리턴한다.
return document.cookie.substring(start, end)
}
// 찾지 못했다면
return ""
}
function openMsgBox()
{
var eventCookie=getCookie("memo");
if (eventCookie != "no")
window.open('팝업창파일','_blank','width=300,height=300,top=50,left=150');
//팝업창의 주소, 같은 도메인에 있어야 한다.
}
openMsgBox();
//-->
</script>
</head>
<body>
</body>
</html>  



팝업창인 pop.htm에 삽입
<html>
<head>
<title></title>
<head>
<script language="JavaScript">
<!--
function setCookie( name, value, expiredays )
{
//같은 창에서만 안띄움.
//expiredays 값은 상관없음.
document.cookie = name + "=" + escape( value ) + "; path=/;";
}
function closeWin()
{
if ( document.myform.event.checked )
setCookie("memo", "no" , 1); // 1일 간 쿠키적용
}
//-->
</script>
</head>
<body onunload="closeWin()">
<form name="myform">
<input type="checkbox" name="event">다음부터 이 창을 열지않음
<input type=button value="닫기" onclick="self.close()">
</form>
</body>
</html>


13.링크걸어서 지정된 사이즈로 열기

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language='JavaScript'>
<!--
function winopen(url)
{
window.open(url,"url","width=517,height=450,history=no,resizable=no,status=no,
scrollbars=yes,menubar=no");
}
//-->
</script>
</head>
<body>
<a HREF="javascript:winopen('주소')">링크걸기</a>
</body>
</html>


14.자동으로 지정된 크기로 브라우저 열기

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language='JavaScript'>
<!--
window.resizeTo(300,300);
window.moveTo(0,0);
//-->
</script>
</head>
<body>
<!--원하는 가로,세로의 크기를 입력해준다.-->
</body>
</html>


15.해상도에 맞추어 전체장으로 늘어남

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
function winMaximizer() {
if (document.layers) {
larg = screen.availWidth - 10;
altez = screen.availHeight - 20;
} else {
var larg = screen.availWidth;
var altez = screen.availHeight;
}
self.resizeTo(larg, altez);
self.moveTo(0, 0);
}
</script>
</head>
<body onload="winMaximizer()">
해상도에 맞추어 전체장으로 늘어남
</body>
</html>


16.이미지 클릭시 html문서없이 큰이미지로 새창띄우기

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
var win1Open = null
function displayImage(picName, windowName,
windowWidth, windowHeight){
return window.open(picName,windowName,"toolbar=no,

scrollbars=no,resizable=no,width=" + (parseInt(windowWidth)+20) + ",height=" + (parseInt(windowHeight)+15))
} function winClose(){
if(win1Open != null) win1Open.close()
} function doNothing(){}
</script> <script language="JavaScript1.1">
function displayImage(picName, windowName,

windowWidth, windowHeight){
var winHandle = window.open("" ,windowName,"toolbar=no,scrollbars=no,

resizable=no,width=" + windowWidth + ",height=" + windowHeight)
if(winHandle != null){
var htmlString = "<html><head><title>Picture</title></head>"
htmlString += "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>"
htmlString += "<a href=javascript:window.close()><img src=" + picName + " border=0
alt=닫기></a>"
htmlString += "</body></html>"
winHandle.document.open()
winHandle.document.write(htmlString)
winHandle.document.close()
}
if(winHandle != null) winHandle.focus()
return winHandle
}
</script>
</head>
<body>
<a href="javascript:doNothing()"
onClick="win1Open=displayImage('큰 이미지파일', 'popWin1', '300', '400')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''">
<img src=이미지파일" border="0"></a>
</body>
</html>


17.몇초후 웹페이지이동하기 소스예제1

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
function nextWin()
{location = "이동할 URL"}
</script>
</head>
<body onLoad="setTimeout('nextWin()', 1000)"> <!--1000 이 1초 입니다.-->
바로 이동한 원하는 사이트로 이동함
</body>
</html>


18.몇초후 웹페이지이동하기 소스예제2

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
self.location.replace('이동할 URL');
</script>
</head>
<body>
바로 이동한 원하는 사이트로 이동함
</body>
</html>


19.자동새로고침하기

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
<!--
setTimeout("history.go(0);", 3000); // 1초는 1000 입니다.
-->
</script>
</head>
<body>
자동새로고침하기
</body>
</html>


20.해상도에 따라 다른 웹페이지 열기

<html>
<head>
<title>..</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language="JavaScript">
<!--
function redirectPage() {
var url800x600 = "main1.html"; //800*600 에서 열릴문서
var url1024x768 = "main2.html"; //1024*768 에서 열릴문서
var url1152x864 = "main3.html"; //1152*864 에서 열릴문서

if ((screen.width == 800) && (screen.height == 600))
window.location.href= url800x600;
else if ((screen.width == 1024) && (screen.height == 768))
window.location.href= url1024x768;
else if ((screen.width == 1152) && (screen.height == 864))
window.location.href= url1152x864;
else window.location.href= url800x600;
}
//-->
</script>
</head>
<body Onload="redirectPage()">  
</body>
</html>

30.HTML파일 없이 이미지 사이즈에 맞게 팝업창 띄우기.
<script Language="Javascript">
<!-- //////////////////////////////////////////////////////////////
//*****************************************************************
// Web Site: http://www.CginJs.Com
// CGI 와 JavaScript가 만났을 때 = C.n.J ☞ http://www.CginJs.Com
// CGI 와 JavaScript가 만났을 때 = C.n.J ☞ webmaster@CginJs.Com
// C.n.J 자바스크립트 자동 생성 마법사 ☞ http://www.CginJs.Com
// C.n.J 자바스크립트(JavaScript) 가이드 ☞ http://www.CginJs.Com
// C.n.J CSS(Cascading Style Sheet) 가이드 ☞ http://www.CginJs.Com
// Editer : Web Site: http://www.CginJs.Com
//*****************************************************************
/////////////////////////////////////////////////////////////// -->
var cnj_img_view = null;
function cnj_win_view(img){
img_conf1= new Image();
img_conf1.src=(img);
cnj_view_conf(img);
}

function cnj_view_conf(img){
if((img_conf1.width!=0)&&(img_conf1.height!=0)){
cnj_view_img(img);
} else {
funzione="cnj_view_conf('"+img+"')";
intervallo=setTimeout(funzione,20);
}
}

function cnj_view_img(img){
if(cnj_img_view != null) {
if(!cnj_img_view.closed) { cnj_img_view.close(); }
}
cnj_width=img_conf1.width+20;
cnj_height=img_conf1.height+20;
str_img="width="+cnj_width+",height="+cnj_height;
cnj_img_view=window.open(img,"cnj_img_open",str_img);
cnj_img_view.focus();
return;
}
</script>



<a href="javascript:cnj_win_view('../img/cnjlogo.gif')"><img src="../img/cnjlogo.gif" border="0" width="247" height="55"></a>

32.이미지사이즈에 맞게 새창이 열리며 휠마우스 효과를 내줌
그리고 메인(imgmove-main.html)에서 새창 띄워주는 부분

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function cnjOpen() {
window.open('img-move.html','cnjOpenWin','width=350,height=250,toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0');
}
// End -->
</script>
<a href="javascript:cnjOpen()"><img src="test.jpg" width="200" height="150" border="0"></a>
</center>

이 부분은 이미지를 보여줄 새창(img-move.html)입니다.
<style>
body {cursor:move;}
</style>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad="fitWindowSize();">

<SCRIPT LANGUAGE="JavaScript">
// 이미지는 별도로 제공하지 않습니다.
<!-- CGI 와 JavaScript가 만났을 때=CnJ ☞ http://www.cginjs.com -->
<!-- CGI 와 JavaScript가 만났을 때=CnJ ☞ webmaster@cginjs.com -->
var ie = 1;
var windowX, windowY;
var bLargeImage = 0;
var x,y;

var InitX = 500;

// 이미지가 새창에 맞게 조절되는 부분

function fitWindowSize()
{
if( ie )
{
window.resizeTo( InitX, InitX );
width = InitX - (document.body.clientWidth - document.images[0].width);
height = InitX - (document.body.clientHeight - document.images[0].height);
windowX = (window.screen.width-width)/2;
windowY = (window.screen.height-height)/2;
if( width > screen.width-50 )
{
width = screen.width-50;
windowX = 20;
bLargeImage = 1;
}
if( height > screen.height-80 )
{
height = screen.height-80;
windowY = 20;
bLargeImage = 1;
}
window.moveTo( windowX, windowY );
window.resizeTo( width, height+4 );
}
else
{
window.innerWidth = document.layers[0].document.images[0].width;
window.innerHeight = document.layers[0].document.images[0].height;
}
}

// 휠마우스 효과

function move() {
if(bLargeImage){ window.scroll(window.event.clientX - 50,window.event.clientY -50);
}
}

// 오른쪽 왼쪽 마우스 클릭시 창닫는 부분

function click() {
if ((event.button==1) || (event.button==2) || (event.button==3)) {
top.self.close();
}
}
document.onmousedown=click

</script>
<img src="http://www.cginjs.com/cgi/js/test.jpg" border="0" ONMOUSEMOVE="move();">
Posted by 알 수 없는 사용자
,