时间有限,先发源码,以后再整理:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function getOptionTableEdition(){
var tableE = document.getElementById("table");
var mySelect = document.getElementById("select")
if (mySelect.options[0].selected){
while(tableE.childNodes.length >0){
tableE.removeChild(tableE.childNodes[0]);
}
var txt =document.createTextNode(mySelect.options[0].value);
tableE.appendChild(txt);
}else if( mySelect.options[1].selected){
while(tableE.childNodes.length >0){
tableE.removeChild(tableE.childNodes[0]);
}
var txt =document.createTextNode(mySelect.options[1].value);
tableE.appendChild(txt);
}
}
function getOptionTextEdition(){
var TextE = document.getElementById("textfield");
var mySelect = document.getElementById("select")
if (mySelect.options[0].selected){
TextE.setAttribute("value",mySelect.options[0].value);
}else if( mySelect.options[1].selected){
TextE.setAttribute("value",mySelect.options[1].value);
}
}
function getOptionHiddenEdition(){//待测试
var Hidden = document.getElementById("hiddenField");
var mySelect = document.getElementById("select")
if (mySelect.options[0].selected){
Hidden.setAttribute("value",mySelect.options[0].value);
}else if( mySelect.options[1].selected){
Hidden.setAttribute("value",mySelect.options[1].value);
}
}
function getOptionTextAreaEdition(){
var textarea = document.getElementById("textarea");
var mySelect = document.getElementById("select")
if (mySelect.options[0].selected){
while(textarea.childNodes.length >0){
textarea.removeChild(tableE.childNodes[0]);
}
var txt =document.createTextNode(mySelect.options[0].value);
textarea.appendChild(txt);
}else if( mySelect.options[1].selected){
while(textarea.childNodes.length >0){
textarea.removeChild(textarea.childNodes[0]);
}
var txt =document.createTextNode(mySelect.options[1].value);
textarea.appendChild(txt);
}
}
</script>
</head>
<body>
<select name="select" id="select" onChange="getOptionHiddenEdition();">
<option value="1">第一个</option>
<option value="2" selected>第二个</option>
</select>
<table width="200" border="1" >
<tr>
<td id="table"> </td>
</tr>
</table>
<p>
<input type="text" id="textfield" >
</p>
<p> </p>
<form name="form1" method="get" action="">
<input name="hidden" type="hidden" id="hiddenField">
<input type="submit" name="Submit" value="提交">
</form>
<p> <textarea id="textarea"></textarea>
</p>
</body>
</html>