我是网络应用程序开发的新手,我在HTML页面上有2个不同的框架。一个是graphs.jsp,另一个是location.jsp。 Location.jsp中有一个滑块,它提供了一些我想传递给graphs.jsp的值。
这是Location.jsp上的代码
<script>
var Myvariable=0;
$( function()
{
$( "#slider1" ).slider({
value:100,
min: 0,
max: 500,
step: 10,
slide: function( event, ui ) {
Myvariable=ui.value;
$( "#amount" ).val( "$"+Myvariable);
}
});
$( "#amount" ).val( "$" + $( "#slider1" ).slider( "value" ) );
} );
</script>
这是我的Graph.jsp
<script language="javascript" type="text/javascript">
var FetchedValueFromLocation.jsp= xxxx;
var j = 1305;
var k = 1512;
var l = j * k + i;
<%-- For piechart (GOOGLE graphs) --%>
google.charts.load("current", {packages: ["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Lighting', FetchedValueFromLocation.jsp],
['HVAC', j],
['Misc', k]
]);
var options = {
title: 'END USE',
width: 400,
height: 300,
pieHole: 0.4
};
var chart3 = new google.visualization.PieChart(document.getElementById('donutchart'));
chart3.draw(data, options);
chart3.setPlotArea(30, 20, 200, 200);
}
</script>
现在我想获取Location.jsp中的滑块值并实时更新Graphs.jsp中饼图的值。我使用谷歌图库,是否可以使用它或如何使这项工作。请帮忙。谢谢!