⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 paint.jsp

📁 用AJAX实现的SVG仪表盘
💻 JSP
字号:

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <script type='text/javascript' src='/ajaxSVG/dwr/interface/MeterRemote.js'></script>
  <script type='text/javascript' src='/ajaxSVG/dwr/engine.js'></script>

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


    <base href="<%=basePath%>">
    
    <title>My JSP 'DyMeter.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">
    
<script >
var last_degree=0,curr_degree=320;
    function getValue()
{
    MeterRemote.getDegree(loadinfo);
    
}

function loadinfo(data)
{

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

        chart=svgDocument.getElementById("line2");

        chart.setAttribute( "from", last_degree+",252,200");
        chart.setAttribute( "to", curr_degree+",252,200");
        chart.beginElement();
        last_degree=curr_degree;
}

function run()
{

window.setTimeout("run()", 9000);

getValue();

}
  
  </script>

  </head>
  
  <body >
  <span id='reply1' class='reply'></span><br>
<button onclick="run()">开始</button>

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

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -