1

我在 javascript 和 jquery 中使用 nubie。我想改变我的“tipe”<-(变量)槽组合框的值

这是脚本:

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>

对不起,如果我的帖子乱七八糟。非常感谢。

4

2 回答 2

2
$( "#combobox" ).change(function() {
    tipe = $(this).val();
});
于 2013-11-11T09:09:33.670 回答
0

尝试这个

$('#combobox').on('change', function() {
    tipe= this.value;
});
于 2013-11-11T09:13:38.993 回答