请教各位高手!看看我的错误在那里!

zhoupu2004 2004-11-21 11:27:03
小弟是新手,以前从来没有用过js,而且js也没有调试器,遇到问题很痛苦,只好来这里求助了!253各位达人先!
<%@ page import="java.util.*"%>
<jsp:useBean id="GISInstance" scope="page" class="com.jspdev.GetGPSInfo">
</jsp:useBean>
<%
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
<html>
<head>
<title>read DB</title>
<meta http-equiv="Refresh" content="60;url=/myapp/readDB.jsp">
</head>
<script language="javascript">
function accessActiveX()
{
alter("<%=GISInstance.getLongitude()%>");
window.document.userControl1.setLongitude("<%=GISInstance.getLongitude()%>");
window.document.userControl1.setLatitude("<%=GISInstance.getLatitude()%>");
window.document.userControl1.setSpeed("<%=GISInstance.getSpeed()%>");
}
</script>
<body>
<body onload="accessActiveX()" topmargin="0" leftmargin="0" rightmargin="0"
bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">
<OBJECT ID="UserControl1"
CLASSID="CLSID:753C47BF-45D5-401D-A852-DD27DC9EE136"
CODEBASE="GISMap.CAB#version=1,0,0,0">
</OBJECT>
longitude:<%=GISInstance.getLongitude()%>
</body>
</html>
这个老是报错!



我是根据下面这个来做的,下面的这个jsp页面却能很好的运行,没有问题!
<%@ page import="java.util.*"%>
<jsp:useBean id="GISInstance" scope="page" class="com.jspdev.GetGPSInfo">
</jsp:useBean>

<html>
<head>
<title>read DB</title>
<meta http-equiv="Refresh" content="45;url=/myapp/readDB1.jsp">
</head>
<script language="javascript">
alert("<%=GISInstance.getLongitude()%>")
</script>
<body>

longitude:<%=GISInstance.getLongitude()%>

</body>
</html>
...全文
67 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
javafaq2004 2004-11-24
  • 打赏
  • 举报
回复
你试试:

<%@ page import="java.util.*"%>
<jsp:useBean id="GISInstance" scope="page" class="com.jspdev.GetGPSInfo">
</jsp:useBean>
<%
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
<html>
<head>
<title>read DB</title>
<meta http-equiv="Refresh" content="60;url=/myapp/readDB.jsp">
</head>
<body>
<body topmargin="0" leftmargin="0" rightmargin="0"
bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">
<OBJECT ID="UserControl1"
CLASSID="CLSID:753C47BF-45D5-401D-A852-DD27DC9EE136"
CODEBASE="GISMap.CAB#version=1,0,0,0">
</OBJECT>
longitude:<%=GISInstance.getLongitude()%>
</body>
</html>
<script language="javascript">
function accessActiveX()
{
alter("<%=GISInstance.getLongitude()%>");
window.document.userControl1.setLongitude("<%=GISInstance.getLongitude()%>");
window.document.userControl1.setLatitude("<%=GISInstance.getLatitude()%>");
window.document.userControl1.setSpeed("<%=GISInstance.getSpeed()%>");
}
accessActiveX();
</script>

也就是说把onload调用放到最后直接调用。关键注意对象加载需要时间。
zhoupu2004 2004-11-22
  • 打赏
  • 举报
回复
呵呵,readDB.jsp运行的结果就是报错说javascript error.似乎我从jbean里面取来的数据没有传到activex控件里面.
rootcn 2004-11-22
  • 打赏
  • 举报
回复
关注一下,你可以再将运行的结果贴出来。
zhoupu2004 2004-11-22
  • 打赏
  • 举报
回复
感谢楼上老大的回复.不过我想光是调整function的位置应该是不能解决这个问题的.我试了一下,确实不行.
javafaq2004 2004-11-22
  • 打赏
  • 举报
回复
<%@ page import="java.util.*"%>
<jsp:useBean id="GISInstance" scope="page" class="com.jspdev.GetGPSInfo">
</jsp:useBean>
<%
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
%>
<html>
<head>
<title>read DB</title>
<meta http-equiv="Refresh" content="60;url=/myapp/readDB.jsp">
</head>
<body>
<body onload="accessActiveX()" topmargin="0" leftmargin="0" rightmargin="0"
bottommargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">
<OBJECT ID="UserControl1"
CLASSID="CLSID:753C47BF-45D5-401D-A852-DD27DC9EE136"
CODEBASE="GISMap.CAB#version=1,0,0,0">
</OBJECT>
longitude:<%=GISInstance.getLongitude()%>
</body>
</html>
<script language="javascript">
function accessActiveX()
{
alter("<%=GISInstance.getLongitude()%>");
window.document.userControl1.setLongitude("<%=GISInstance.getLongitude()%>");
window.document.userControl1.setLatitude("<%=GISInstance.getLatitude()%>");
window.document.userControl1.setSpeed("<%=GISInstance.getSpeed()%>");
}
</script>

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧