function ChangeOpacity(x)
var opacity=x.options[x.selectedIndex].text;
var el=document.getElementById("p1");
if (el.style.opacity!==undefined)
{el.style.opacity=opacity;}
{alert("Your browser doesn't support this example!");}
<p id="p1">请从下面的例子中选择一个值,以改变此元素的不透明度。</p>
<select onchange="ChangeOpacity(this);" size="5">
<option selected="selected" />1