<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>测试</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script>
function abc(obj){
if(obj.value==2){
abc_v.innerHTML="上海";
}else{
abc_v.innerHTML="天津";
}
}
</script>
</head>
<body>
<form name="form1" onsubmit="return check_form()"> <select id="AA" name="AA" onchange="abc(this)">
<option value="1" selected>天津</option>
<option value="2">上海</option>
</select></form>
<span id="abc_v">天津</span>
</body>
</html>
上面的js触发,因为加载了第1行的声明语句,在FF下无法触发
在网上找了很长时间 找到一篇相关的文章
http://www.cqzol.com/fabrication/Javascript/200806/174846.html却无法解决我的问题有经验的朋友,帮我改一下js触发代码,不删第一行的声明同时能触发js.谢谢大家
解决方案 »
- 我遇到问题了!就是左侧的二级弹出菜单被右边的JS幻灯片档住了?我用z-index不管用,跪求高手帮忙!急
- javascript的function中可能申明全局变量吗?
- javascript自動設置IE首頁?
- 关于js的原型的一点问题,求指教
- map如何解释?
- 小问题
- 怎样删除表单元素?表格的单元格中有名称为aaa的表单元素,aaa可能为text,button,hidden,textArea具体对应的元素不确定,当单击按钮时可以删
- 邮箱 [email protected] 的密碼沒了我怎麼破了它,請大家幫幫忙!!
- 当鼠标放到按钮上,按钮颜色改变,鼠标离开按钮时,按钮颜色恢复.怎样实现?
- jquery重复单击事件求助
- 请教一个导航菜单高亮显示问题(急)
- Javascrip对输入表单的验证问题
function abc(obj){
if(obj.value==2){
document.getElementById("abc_v").innerHTML="上海";
}else{
document.getElementById("abc_v").innerHTML="天津";
}
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>测试</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script>
function abc(obj){
if(obj.options[obj.selectedIndex].value==2){
document.getElementById("abc_v").innerHTML="上海";
}else{
document.getElementById("abc_v").innerHTML="天津";
}
}
</script>
</head>
<body>
<form name="form1" onsubmit="return check_form()"> <select id="AA" name="AA" onchange="abc(this)">
<option value="1" selected>天津</option>
<option value="2">上海</option>
</select></form>
<span id="abc_v">天津</span>
</body>
</html>
但在IE6下 就不灵了。