인터넷정보

콤보박스(셀렉트박스다운) 메뉴 미 선택시 컬러 바뀌게...

알 수 없는 사용자 2007. 10. 18. 13:49

http://oxtag.com/zboard/zboard.php?id=js&no=439

<form name="qform">
<select name="qsel" onfocus="stop_roll();" onmouseover="stop_roll();" onclick="flag_expand = 'Y';" onblur="flag_expand = 'N'; start_roll();" onmouseout="start_roll();" onchange="eval(this.value); this.blur();">
<option>-선 택-</option>
<option value="window.open('http://www.empas.com/');">엠파스</option>
<option value="window.open('http://www.naver.com/');">네이버</option>
<option value="window.open('http://www.daum.net/');">다음</option>
<option value="alert('My name is Camelot. ^-^ㆀ'); alert('Nice to meet you!');">Who are you?</option>
<option value="document.body.style.background = '#AAAAAA';">배경색 바꾸기</option>
<option value="document.body.style.background = '';">배경색 원래대로</option>
</select>
</form>

<script language="javascript">
<!--
var obj = document.qform.qsel, flag_expand = 'N', cnt = 1, timer;

function start_roll(){
var color_=new Array('#ff9900','#33CC00');
if(flag_expand == 'N'){
if(cnt >= obj.length) cnt = 1;
obj.options[cnt].selected = true;
obj.options[cnt].style.color= cnt% 2 == 0 ? color_[0] : color_[1];
cnt++;
timer=setTimeout('start_roll()', 1000);
}
}

function stop_roll(){
obj.options[0].selected = true;
clearTimeout(timer);
}

start_roll();
//-->
</script>


반응형