1
<html>
<script>
function show(){
    var select=document.getElementById("select");
    var text=getText(select,0);
    alert(text);
}
function getText(select,index){
    if(select[index].value==select.value){
        return select[index].innerHTML;
    }else{
        return getText(select,index+1);
    }
}
</script>
<body>
<select id="select">
<option value="a">中国</option>
<option value="b">美国</option>
<option value="c">英国</option>
</select>
<input type="button" value="显示" onclick="show()"/>
</body>
</html>2
setInterval("foo()",1000)3
20,true,false

解决方案 »

  1.   

    <select id="select" onchange="alert(this.options[this.selectedIndex].text)">
    <option value="a">中国</option>
    <option value="b">美国</option>
    <option value="c">英国</option>
    </select>
      

  2.   

    第1题:
    function   show(){ 
            var  select=document.getElementById( "select ").options;
            var  text=getText(select,0); 
            alert(text); 

    function   getText(select,index){ 
            if(select[index].value==select.value){ 
                    return   select[index].innerHTML; 
            }else{ 
                    return   getText(select,index+1); 
            } 

    第2题:
    setTimeout("foo()",1000);//1s后执行foo(),且只执行一次
    (另外补充下:setInterval("foo()", 1000);//每隔1s就调用一次foo(),会反复调用)第3题:
    依次弹出对话框:20、true、false。