select 聯動的用法

<table>

訪談類型*/<font>:

<select>

{foreach item=aList key=key from=$talkParentType}

{if $key == $talkColumnInfo.channel_id}

<option>{$aList}/<option>

{else}

<option>{$aList}/<option>

{/if}

{/foreach}

<select>

{if !empty($talkColumnInfo.title)}

<option>{$talkColumnInfo.title}/<option>

{/if}

html 代碼:

/<table>


js部分:

var simple_channel_id = '{$simple_channel_id}';


{literal}

$(document).ready(function(){

//不存在訪談類型的時候。

if(simple_channel_id != ''){

changeTalkType(simple_channel_id);

}else{

changeTalkType(1);

}

})

//下拉框選擇訪談子類型

function changeTalkType(parent_id){

//請求子類型的數據

var url = 'cLiveColumnList.php?channel_id='+parent_id+'&operate_type=select';

$("#talk_child_type").load(url);

}


ajax頁面部分:

{if $result != ''}

{foreach item=item key=key from=$result}

<option>{$item.title}/<option>

{/foreach}

{/if}


分享到:


相關文章: