我正在尝试重用我在选项选择中调用的javascript函数。为了重用它,我需要将txt参数传递给它,以便函数可以标识它应该在哪里例如绘制图表或选择了什么选项
我尝试在“
它可能很简单,但是我真的首先尝试了搜索...
根据{{3}},语法是正确的,不是吗?
<select id="product_by_season" onchange="drawChart('product_by_season', 'donut-chart-season-chart', 'seasonchannelselect')" >
[{foreach from=$productcount item=count name=season key=key}]
功能:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {
packages: ["corechart"]
});
google.charts.setOnLoadCallback(drawChart);
function drawChart(optionselect, chartvisual, maxcount ) {
console.log(optionselect);
console.log(chartvisual);
console.log(maxcount);
var listbox = document.getElementById(optionselect);
控制台输出:
undefined index.php:564:4
undefined index.php:565:4
undefined index.php:565:4
TypeError: listbox is null