1
我想用按钮单击来填充图表。Jquery,highchart:按钮单击时渲染阴谋,回滚
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#hello').click(function() {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
series: [{
data: [29.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4]
}] //series
}); //chart
chart.series[0].setData([29.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4]);
//return false;
});; //button click
}); //doc ready
</script>
</head>
<body>
<h3>generate table and plot</h3>
<form id="helloform">
<table border=1>
<tr><td>probability, p: </td><td><input type=text name=p size=5></td></tr>
<tr><td colspan=2 align=center><button id="hello">populate table</button></td></tr>
<tr>
<td colspan=2 align=center><input type=reset></td></tr>
</table>
</form>
<div id="container" style="height: 400px"></div>
</html>
由于某些原因,点击后,情节呈现并消失。我想这可能是因为.ready函数,我试着加载函数而不是准备好,没有任何反应。任何帮助。
通过我新的jQuery和JavaScript的甚至
感谢
阿南塔
谢谢,就是它了。研究超过一个小时..应该在这里提交.. – Ananta 2012-03-15 21:10:33
我又回来帮忙,我想在joomla网站上添加这个。对于没有点击操作的人来说,高图可以正常工作,但对此无效。顺便说一句,我不得不在'$(document).ready'之前添加'(function($){..'...)解决方案 – Ananta 2012-03-21 16:36:53
添加一个新问题作为一个新问题。 ){''''''''''''''''''''''''是毫无意义的 - id与http://api.jquery.com/ready/做同样的事情,所以两者都会立即执行内部处理。 – StilgarBF 2012-03-22 16:33:14