|
楼主 |
发表于 2011-1-17 10:34:24
|
显示全部楼层
本帖最后由 julia 于 2011-1-17 10:35 编辑
用 firebug 调试没有任何错误
测试源码
--------Controller - test.php
class Test extends Controller
{
function __construct()
{
parent::Controller();
}
function index()
{
if ($this->input->post('submit')) echo 'submited id='.$this->input->post('cat_id');
$$data['category'] = array(
'type' => 1,
'category' => 2,
'region' => 3
);
$this->load->view('test', $data);
}
}
--------views - test.php
<script language="JavaScript">
function submit2()
{
var s=document.getElementById("ops");
alert(s.value); //显示正确
document.form.submit(); //没有按常规的submit()返回Controller
}
</script>
<?php echo form_open(site_url($this->uri->uri_string()),array('name' => 'form', 'id' => 'form')); ?>
<?php echo form_dropdown('cat_id', $category, set_value('cat_id',$value['category']),'id="ops" onChange="submit2()"'); ?>
<input type="submit" name="submit" value="change">
</form> |
|