简单问题!大家帮帮我!
<select name= "genre " id= "genre " >
<option value= "PCB " style= "background-color:#FfEEFF;color:green;font-weight: bold "> P C B </option>
<option value= "IC " style= "background-color:#EEFFFf;color:red;font-weight: bold "> I C </option>
</select> <input name= "plan " type= "text " id= "plan " size= "15 " maxlength= "30 " value= "? ">
如何让我选择列表/菜单中的PCB时,plan文本框中出现有PCS,选择列表/菜单中的IC时,选择EA
------解决方案-------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
<SCRIPT LANGUAGE= "JavaScript ">
function genrefun()
{
if (document.getElementById( "genre ").value == "PCB ")
document.getElementById( "plan ").value = "PCS ";
else if (document.getElementById( "genre ").value == "IC ")
document.getElementById( "plan ").value = "EA ";
}
</SCRIPT>
</head>
<body>
<form id= "form1 " name= "form1 " method= "post " action= " ">
<select name= "genre " id= "genre " onchange= "genrefun() ">
<option value= "PCB " style= "background-color:#FfEEFF;color:green;font-weight: bold "> P C B </option>
<option value= "IC " style= "background-color:#EEFFFf;color:red;font-weight: bold "> I C </option>
</select> <input name= "plan " type= "text " id= "plan " size= "15 " maxlength= "30 " value= "PCS ">
</form>
</body>
</html>