问一个Ajax控制SVG的问题

tsinge 2006-07-17 04:44:32
环境部署正常,SVG插件也安装了,这是一个从IBM下载的例子,可就是运行不正常(欧尔正常)
weblogic 6.1

原始JSP文件如下:
************************************************************************
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
<head>
<script type='text/javascript' src='/dwr/interface/MeterRemote.js'></script>
<script type='text/javascript' src='/dwr/engine.js'></script>

<script type='text/javascript' src='/dwr/util.js'></script>

<base href="<%=basePath%>">

<title>Ajax 实时监控</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="ajax test page">

<script >
var last_degree=0,curr_degree=270;
function getValue()
{
MeterRemote.getDegree(loadinfo);

}

function loadinfo(data)
{

DWRUtil.setValue("reply1", data);
curr_degree=data;
var svgDocument = window.sample2.getSVGDocument();

chart=svgDocument.getElementById("line2");

chart.setAttribute( "from", last_degree+",250,250");
chart.setAttribute( "to", curr_degree+",250,250");
chart.beginElement();
last_degree=curr_degree;
}
function aaa()
{
var svgDocument = window.sample2.getSVGDocument();

chart=svgDocument.getElementById("line2");
//chartext.setAttribute( "x", "0");
chart.beginElement();
}

function run()
{
window.setTimeout("run()", 5000);
getValue();
}

</script>

</head>

<body >

<button onclick="run()">start</button>
<span id='reply1' class='reply'></span><br><br>

<embed id="sample2" src="MeterChart.svg" width="625.5" height="393" type="image/svg+xml">
</body>
</html>
********************************************************************************


以上代码运行后,SVG加载不了,后将第三行
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

屏蔽,并将<base href="<%=basePath%>"> 写死

页面提示“拒绝访问” 请教高人
...全文
111 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

52,797

社区成员

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

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