<select name="month" onchage="mm()">
<!--{@ range(1, 12)}-->
<option value="{.value_}"<!--{?month == .value_}--> selected<!--{/}-->>{.value_}</option>
<!--{/}-->
</select>
js code function mm()
{
var month = $('select[name=month]>option:selected').val();
var year = $('input[name="year"]').val();
var lunchInit = window.open('/hr/lunch/init/'+year+'/'+month, 'lunchInit', 'top=0,left=0,toolbar=0,directories=0,menubar=0,resizable=0,scrollbars=1,width=620,height=600'); //我想要的结果是当前页面中按照选择好的月份,自动刷新到那个页面,不是要弹出窗口,而是在当前页面更改。但这里不知道怎么修改。
lunchInit.focus();
}当前页面是http://***/hr/lunch/init/2011/9 这种形式

解决方案 »

  1.   

    window.location = '/hr/lunch/init/'+year+'/'+month;
      

  2.   

    function mm()
    {
    var month = $('select[name=month]>option:selected').val();
    var year = $('input[name="year"]').val();
    window.location = '/hr/lunch/init/'+year+'/'+month;
    }
      

  3.   

    还有一个问题http://***/hr/lunch/init/2011/9 这种形式的/2011/9 这部分给去掉?
      

  4.   

    二楼的方法尝试了,但在select中选择其他月份的时候,怎么没什么反映? 还有http://***/hr/lunch/init/2011/9 这种形式的/2011/9 这部分怎么给隐藏掉?
      

  5.   


    window.location = '/hr/lunch/init/'+year+'/'+month;这样不就是年/月这种形式吗
      

  6.   

    是,但这个url的地址中想让年月给隐藏掉,还有在select中选择其他月份的时候,怎么没什么反映?是不是我的代码哪里写错了
      

  7.   


    你加个alert(month)
    看看能拿到吗~·
      

  8.   

    function mm()
    {
    var month  = $('select[name=month]>option:selected').val();
    var year   = $('input[name="year"]').val();
    window.location = '/hr/lunch/init/'+year+'/'+month;
    alert(month);
    }
    这样写的,拿不到