asp.net基于jquery的ajax二级联动

刚刚修改的  以前是很早之前写的了

 

有很多不足之处

 

现在写最新的吧(现在的代码高亮怎么没有html的了?)

 

那html 直接贴代码了 哎

 

 

 

index.aspx

 

 

<script src="../ADMIN/js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {

//预先加载第一个select,加载品牌,看好加载的的页面BrandHandler.ashx

        $.post('BrandHandler.ashx', {}, function(data) { $("#carbrand").html(data) }, 'html');

//当选择品牌的时候加载二级车系,构成联动
        $("#carbrand").change(function() {
        $.post('TypeHandler.ashx', { cartype: $(this).val() }, function(data) { $("#cartype").empty().html(data) }, 'html');
        });
    });
</script>
<table  width="950" height="35" border="0" cellpadding="0" cellspacing="0" class="left_tb">
  <tr>
    <td width="70" align="right" background="../IMAGES/b_4.gif"><img src="../IMAGES/serch_so.gif" width="59" height="17" /></td>
    <td width="100" background="../IMAGES/b_4.gif">
        <select id="carbrand" name="carbrand" >
            <option value="-1">--选择品牌--</option>
        </select>
        </td>
    <td width="105" background="../IMAGES/b_4.gif">
        <select id="cartype" name="cartype" >
            <option value="-1">--选择车系--</option>
        </select>
        </td>
    <td background="../IMAGES/b_4.gif" style="width:80px">
        &nbsp;
       <a href="###" id="search_type"><img  src="../IMAGES/serch.gif" alt="搜索" style="border:0px"/></a>
       </td>
    <td width="120" background="../IMAGES/b_4.gif">
        <input id="TextKeys" type="text"   />
        </td>
    <td width="100" align="left" background="../IMAGES/b_4.gif">
   <a href="###" id="search_news"> <img alt="新闻资讯" src="../IMAGES/serch.gif"  style="border:0"/></a>
    </td>
  </tr>
</table>

 

 

 

 

 

BrandHandler.ashx

 

 

 

 

TypeHandler.ashx

 

 

 

 

 

 

OK    2009-12-04  08:45:29

 

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值