html 动态显示元素文本

<html>   
  <head>   
  <title>dynamic show</title>   
  <meta   http-equiv="Content-Type"   content="text/html;   charset=utf-8">   
  
  </head>     
  <body onload=highlight('haha')>       
  <script>
function highlight(obj){

var selected = document.getElementById("currency");
document.getElementById("spantest").innerHTML=selected.options[selected.selectedIndex].text;

document.getElementById("ptest").style.fontSize="xx-large";
document.getElementById("ptest").style.color="red";

}
</script>
	<tr id="trtest">
		<td colspan=3 id="tdtest" name="tdtest" >
			<select id="currency" name="currency" onchange="highlight('haha')">
				<option id="op1"  value="one">1</option>
				<option id="op2"  value="two">2</option>
			</select>
		<span id="spantest" style="color:red; font-size:xx-large"></span>
		<!--p id="ptest">This is an example paragraph.</p-->
		</td>
	<tr>    
  </body>                                   
 </html> 

你可能感兴趣的:(html)