hahahia

실습 01 본문

Web Programming/JavaScript

실습 01

hahahia 2012. 3. 28. 12:29

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

 <head>

  <title> New Document </title>

  <meta name="Generator" content="EditPlus">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

 </head>

<SCRIPT>

function colorchange()

{

document.getElementById("textcolor").value = document.getElementById("selectcolor").value;

}

function on()

{

document.getElementById("main").bgColor = document.getElementById("selectcolor").value;

}

</SCRIPT>

 <body id = "main">

 <SELECT id="selectcolor" onChange="colorchange()">

<OPTION value="yellow">노랑</OPTION>

<OPTION value="green">초록</OPTION>

<OPTION value="blue">파랑</OPTION>

<OPTION value="red">빨강</OPTION>

 </SELECT>

 <INPUT type="text" id="textcolor" size="6">

 <INPUT type="button" value="배경색 변경" onClick="on()">

 </body>

</html>

Comments