<html>
<head>
<script>
window.onload=function(){
b.onclick=function(){
document.bgColor=sel.value;
}
}
</script>
</head>
<body>
<select id="sel">
<option>red</option>
<option>orange</option>
<option>gray</option>
</select>
<input type="button" id="b" value="배경색상변경하기">
</body>
</html>
<head>
<script>
window.onload=function(){
b.onclick=function(){
document.bgColor=sel.value;
}
}
</script>
</head>
<body>
<select id="sel">
<option>red</option>
<option>orange</option>
<option>gray</option>
</select>
<input type="button" id="b" value="배경색상변경하기">
</body>
</html>
<html>
<head>
<script>
window.onload=function(){
sel.onchange=function(){
document.bgColor=sel.value;
}
}
</script>
</head>
<body>
<select id="sel">
<option>red</option>
<option>orange</option>
<option>gray</option>
</select>
</body>
</html>
'개발하자 > 자바스크립트' 카테고리의 다른 글
createElement, appendChild (0) | 2015.02.26 |
---|---|
document 객체 (0) | 2015.02.26 |
주소선택해서 이전창으로 불러오기 (0) | 2015.02.26 |
text value값을 id로 이용하기 eval,getElementById (0) | 2015.02.26 |
window.open(새창띄우기) (0) | 2015.02.26 |