마우스를 온 시키면 새로운 창이 뜨고 다시 마우스를 치우면 새로 뜬 윈도우를 없애는 스크립트입니다.
| Script Example |
<html> <head><title>Demo30</title>
<script language="javascript">
<!--
headstring = "<HTML><HEAD><TITLE>스크립트
예제</TITLE><HEAD>" //
창이름 지정
bodystring = "<BODY bgcolor=white>"
endstring = "</BODY></HTML>"
iswin1 = 0;
function me() { if (iswin1==1)
return; win1 = open ("","","width=300,height=250");
// 새로운 윈도우 크기 지정
win1.document.open();
win1.document.write (headstring);
win1.document.write (bodystring);
text1 ="안녕하세요<p>";
text1 += " 반갑습니다. <p>";
text1 += " 자동으로 윈도우가 뜹니다. <p>";
text1 += " 그죠? <p>";
text1 = "<center><font
size=2>" + text1 + "</font></center>";
win1.document.write (text1);
win1.document.write (endstring);
win1.document.close();
iswin1 = 1;
}
function me1() { if (iswin1==0)
return; win1.close();
iswin1 = 0;
}
//-->
</script> </head>
<body bgcolor=white> <center>
<a href='#' onmouseover="me()"
onmouseout="me1()"
onclick="me1()">마우스를 이곳에 놓으면 새로운 창이 뜹니다.</a>
<P> 마우스를 치우면 없어지죠. </center>
</body> </html> |
|
|
| 설명 |
| 파란색부분에서 새롭게 뜰 윈도우의 내용을 입력하시면 됩니다. 빨간색으로
표시된 부분이 마우스가 온 되면 호출되는 함수과 오프 되면 호출되는 함수를
지정하고 있습니다. |
|
|
|
|