====================================================================
다중 셀렉트~
====================================================================
<HTML>
<HEAD>
<TITLE></TITLE>
<style>
#sub1, #sub2, #sub3
{ position: absolute;left: 180px;visibility: hidden;z-index: 3}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
catnumber = 3 // 카테고리의 갯수 설정
offset = 150
performOnchange = false
if (document.all) {
docObj = "document.all."
styleObj = ".style"
} else {
docObj = "document."
styleObj = ""
}
function openselect(subcat) {
popupselect = eval(docObj + subcat + styleObj)
popupselect.visibility = "visible"
}
function closeselect(submenu,subcat){
popupselect = eval(docObj + subcat + styleObj)
if (submenu.selectedIndex != 0) {
popupselect.visibility = "hidden"
numchoice = submenu.selectedIndex
choice = submenu[numchoice].value
myForm.subcategory.value = choice
submenu.selectedIndex = 0
}
}
function lock() {
performOnchange = false
}
function unlock() {
performOnchange = true
}
function selectSub(cat) {
for (i=1; i <= catnumber; i++) {
subcat = "sub" + i
popupselect = eval(docObj + subcat + styleObj)
popupselect.visibility = "hidden"
}
if (performOnchange == true) {
letsopen = "sub" + cat.selectedIndex
if (letsopen == "sub0") {
alert("카테고리를 선택 해 주세요")
choice = "- 서브 카테고리 -"
myForm.subcategory.value = choice
cat.focus()
} else {
openselect(letsopen)
lock()
}
}
}
// -->
</script>
</HEAD>
<BODY>
<!---- 첫번째 서브 카테고리 설정 ----->
<span id="sub1">
<select name="sub_singer" onchange="closeselect(this,'sub1')">
<option selected value="">- 서브 카테고리 -
<option value="1">1
<option value="2">2
<option value="3">3
</select>
</span>
<!---- 두번째 서브 카테고리 설정 ----->
<span id="sub2">
<select name="sub_hobby" onchange="closeselect(this,'sub2')">
<option selected value="">- 서브 카테고리 -
<option value="가">가
<option value="나">나
<option value="다">다
</select>
</span>
<!---- 세번째 서브 카테고리 설정 ----->
<span id="sub3">
<select name="sub_int" onchange="closeselect(this,'sub3')">
<option selected value="">- 서브 카테고리 -
<option value="A">A
<option value="B">B
<option value="C">C
</select>
</span>
<!---- 메인 카테고리 설정 ----->
<select name="main_category" onmouseover="unlock()" onchange="selectSub(this)">
<option selected value="">-- 카테고리 선택 --
<option value="숫자">숫자
<option value="한글">한글
<option value="영어">영어
</select>
<p>
<form name=myForm action="">
<input type="text" name="subcategory" readonly="readonly" value="- 서브 카테고리 -">
<input type=submit value=" 전송 ">
<!------------------------- 여기까지 ---------------------------------->
</BODY>
</HTML>
====================================================================
====================================================================
td 에 스크롤바 생성하기
====================================================================
<table border=0 width=0 height=0 cellspacing=0 cellpadding=0>
<tr>
<td width=200 height=100 valign="top">
<div style="overflow-y:scroll; width:200; height:100; padding:4px">
내용
</div>
</td>
</tr>
</table>
====================================================================
====================================================================
마우스 오른쪽 단추 클릭시 강제이동시키기
====================================================================
script language="JavaScript">
<!--
function click() {if (event.button==2) {
alert('오른쪽마우스 클릭했을때 할말');
location.href="페이지넘길 주소";
}
}
document.onmousedown=click
// -->
</script>
====================================================================
====================================================================
그림에 마우스 오버만 해도 링크 이동
====================================================================
<a href="" onmouseover="parent.location='이동될 주소'"><img src="이미지주소" border="0">
====================================================================
====================================================================
시작과 멈춤이 가능한 스크롤 텍스트
====================================================================
<marquee id="scroller" direction=up scrollAmount=5 width=200 height=150 style="background-color:#eeeeee;border:1px dot #999999">
여기에 원하는 글을 쓰세요 ^_^
</marquee>
<center>
<a href="scroller.start()">시작</a> <a href="scroller.stop()">멈춤</a>
<script language="JavaScript1.2">
if (document.all)
scroller.stop()
</script>
====================================================================
====================================================================
이미지 슬라이드(마우스오버시멈춤)
====================================================================
<script language="JavaScript1.2">
<!--
/*
Conveyor belt slideshow script-
?Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
//Specify the slider's width (in pixels)
var sliderwidth=330
//Specify the slider's height (in pixels, pertains only to NS)
var sliderheight=145
//Specify the slider's scroll speed (larger is faster)
var slidespeed=4
//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="#"><img src="http://skydare.net/img/benner1.gif"; width="90" height="30" border=0></a>'
leftrightslide[1]='<a href="#"><img src="http://skydare.net/img/benner2.gif"; width="90" height="30" border=0></a>'
leftrightslide[2]='<a href="#"><img src="http://skydare.net/img/benner3.gif"; width="90" height="30" border=0></a>'
leftrightslide[3]='<a href="#"><img src="http://skydare.net/img/benner1.gif"; width="90" height="30" border=0></a>'
leftrightslide[4]='<a href="#"><img src="http://skydare.net/img/benner2.gif"; width="90" height="30" border=0></a>'
///////do NOT edit pass this line////////////////////////////////////
var copyspeed=slidespeed
//copy contents of leftrightslide into one variable
for (i=0;i<leftrightslide.length;i++)
finalslide=finalslide+leftrightslide[i]+" "
if (document.all){
//dynamically write out the marquee tag
document.write('<marquee id="ieslider" scrollAmount=0 style="width:'+sliderwidth+'">'+finalslide+'</marquee>')
//stop marquee when mouse is over it
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
//re-enable marquee when mouse is out
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=slidespeed")
}
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
document.ns_slider01.visibility="show"
setTimeout("window.onresize=regenerate",450)
intializeleftrightslide()
}
if (document.all)
ieslider.scrollAmount=slidespeed
}
//NS specific function for initializing slider upon page load
function intializeleftrightslide(){
document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
document. ns_slider01.document.ns_slider02.document.close()
thelength=document.ns_slider01.document.ns_slider02.document.width
scrollslide()
}
//NS specific function for sliding slideshow
function scrollslide(){
if (document.ns_slider01.document.ns_slider02.left>=thelength*(-1)){
document.ns_slider01.document.ns_slider02.left-=slidespeed
setTimeout("scrollslide()",100)
}
else{
document.ns_slider01.document.ns_slider02.left=sliderwidth
scrollslide()
}
}
window.onload=regenerate2
//-->
</script>
<font color="#000000>
<ilayer width=&{sliderwidth}; height=&{sliderheight}; name="ns_slider01" visibility=hide>
<!--~============ LAYER ============~-->
</font><layer name="ns_slider02" onMouseover="slidespeed=0;" onMouseout="slidespeed=copyspeed" id="layer1" left="50" top="50" width="200" height="200" z-index="1"></layer>
<!--~========== END LAYER ==========~-->
</ilayer>
출처:하늘다래
====================================================================
====================================================================
html문서 없이 새창으로 이미지 띄우기
====================================================================
<img src="이미지주소" name="ranimage" border="0">
<script language="JavaScript1.1">
<!--
document.ranimage.src="이미지가 들어있는 폴더"+Math.round(Math.random()*3+.4)+".gif";
// -->
</script>
출처: 하늘다래
====================================================================