<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head> <title>My JSP 'a.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page"> </head>
<body>
<select name="aa">
<option value=1>
公开
</option>
<option value=2>
不公开
</option>
<option value=3>
仅向好友公开
</option>
</select>
<script language="javascript">
alert(s.options[1].selected=true);
aa.options[1].selected=true
</script>
</body>
</html>
这里应该显示不公开的啊 可是还是显示公开 请问什么问题
<html>
<head> <title>My JSP 'a.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page"> </head>
<body>
<select name="aa">
<option value=1>
公开
</option>
<option value=2>
不公开
</option>
<option value=3>
仅向好友公开
</option>
</select>
<script language="javascript">
alert(s.options[1].selected=true);
aa.options[1].selected=true
</script>
</body>
</html>
这里应该显示不公开的啊 可是还是显示公开 请问什么问题
解决方案 »
- 如何把数据集缓存在JS中
- 讨论一下这两种设计模式那种合理,或者给出更好的,大家都来啊~
- 按钮的转换
- 我的插入代码在Dreamweaver中生成 如何传递一些值到下一个页面呢
- 学习Structs大家帮我推介几本好用的书。最好是觉得很好用的那种。资料也可以
- ==========在SSH框架中如何使用jspsmartupload上传文件========
- 【非常非常的感谢】求一个已经解决了中文下载问题的jspSmartUpload 很着急 很着急 希望大家帮帮忙 非常感谢
- 数据库预处理如何处理like?
- 有句话看不懂,请教大家
- 请问struts2如何实现存在数据库的文件下载
- eclipse+jboss测试servlet小问题
- java编写浏览器
不公开
</option>
这样也可以啊,为什么一定要用脚本呢
<head> <title>My JSP 'a.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page"> </head>
<body>
<select name="aa" id='aa'>
<option value=1>
公开
</option>
<option value=2>
不公开
</option>
<option value=3>
仅向好友公开
</option>
</select>
<script language="javascript">
document.getElementById("aa").options[1].selected=true
</script>
</body>
</html>
alert(s.options[1].selected=true);
aa.options[1].selected=true
</script>看你的脚本,alert(s.options[1].selected=true);
请问 s 是什么东西啊,应该在这句就报错了,所以下面都没执行
<script language="javascript">
aa.options[1].selected="selected";
</script>