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
<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
解决方案 »
- javascript中js文件和jquery冲突
- js取字符串中某字符串出现的问题开始到结尾
- useBean文件该放在什么位置
- 有个判断图片文件路径的正则表达式(C#的),在Javascript中不能用,高手帮忙修改一下!谢谢!·
- JavaScript 數字處理函數[parseInt,parseFloat]的问题
- 能否禁止一个IFRAME的垂直滚动条不显示但是可以响应鼠标的滚轮进行滚动?
- 巨难的问题!页面加载自动实现window.open的功能...在线等
- 我想知道!如果从数据库中查不到数据想显示数据找不到的错误!根据什么判断!急
- 样式表的问题oncontextmenu="return false;"
- 百分紧急求助!如何将内嵌在html中的javascript程序转换成其他语言,比如c或delphi
- 求时钟控件,由javascript写的
- js怎样统计一段字符中某个单词或某个标点符号(如:China或.点号)的个数
<option value="a">中国</option>
<option value="b">美国</option>
<option value="c">英国</option>
</select>
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。