im jubie在javascript和jquery中。 我想改变我的“tipe”&lt ;-(可变)槽组合框
的值这是剧本:
tipe = 'report-reg'; //this var that i wanna change
$(document).ready(function () { //this is javascript for chart
// prepare the data
var theme = 'classic';
var source =
{
datatype: "json",
datafields: [
{ name: 'reqtime', type: 'date'},
{ name: 'jumlah'}
],
url: 'include/data_chart/data-reg-day.php?type='+tipe //tipe load value from combobox
};
这是组合框html:
<form method="get" action="" name="combobox">
<div>
<select id="combobox" name="combo-box" onchange="tipe=this.value">
<option>Select report tipe</option>
<option value="report-reg-perday">Per-day Report</option>
<option value="report-reg-perweek">Per-week Report</option>
<option value="report-reg-permonth"> Per-Month Report</option>
</select>
<div style="width:100%; height:500px" id="jqxChart"></div>
</div>
</form>
抱歉,如果我的帖子一团糟。
非常感谢。
答案 0 :(得分:2)
$( "#combobox" ).change(function() {
tipe = $(this).val();
});
答案 1 :(得分:0)
试试这个
$('#combobox').on('change', function() {
tipe= this.value;
});