您当前的位置: 首页 >  jquery

Linux小百科

暂无认证

  • 0浏览

    0关注

    1185博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

jQuery实现简易商城系统项目实操详解

Linux小百科 发布时间:2022-07-17 19:34:09 ,浏览量:0

这篇文章主要介绍了jQuery实现简易商城系统项目实操,文章围绕主题展开详细的内容介绍,具有一定的参考价值,感兴趣的小伙伴可以参考一下

一.效果图

二.body

< body> 
< table border="1" cellpadding="0" cellspacing="0"> 
    < tr>
        < th>< input type='checkbox' name="c1"/>全选< /th>
        < th>商品信息< /th>
        < th>宜美惠价< /th>
        < th>数量< /th>
        < th>操作< /th>
 
    < /tr>
 
    < tr class="tr_0">
        < td>
            < input name="" type="checkbox" value=""/>
           < /td>
           < td>
            < img src="images/sang.gif" class="products"/>天堂雨伞¥32.9元
           < /td>
           < td>
                < img src="images/subtraction.gif" width="20" height="20"/>
            < input type="text" class="quantity" value="1"/>
            < img src="images/add.gif" width="20" height="20"/>
          < /td>
          < td>
                < a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  class="del">删除
          < /td>
       < /tr>
       < tr>
        < td>
            < input name="" type="checkbox" value=""/>
           < /td>
           < td>
            < img src="images/iphone.gif" class="products"/>苹果手机iphone5¥3339元
           < /td>
           < td>
                < img src="images/subtraction.gif" width="20" height="20"/>
            < input type="text" class="quantity" value="1"/>
            < img src="images/add.gif" width="20" height="20"/>
          < /td>
          < td>
                < a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  class="del">删除
          < /td>
       < /tr>
 < /table>
 < a href="#" rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  class="add">添加
< /body>

三.jQuery

< script type="text/javascript" src="js/jquery-1.12.4.js" >< /script>
< script>
    $(function(){
        //点击加号触发事件
        $('[src="images/add.gif"]').click(function(){
            var num=parseInt($(this).prev().val());
            $(this).prev().val(num+1);
        });
        //点击减号触发事件
        $('[src="images/subtraction.gif"]').click(function(){
            var num=parseInt($(this).next().val());
            if(num=len-1 & t1==true){
                $('[name="c1"]').prop("checked",false);
            }
        });
        //添加事件
        $('[class="add"]').click(function(){
            var newD=$('tr:eq(2)').clone();
            $('tr:last').after(newD);
        });
         
        //输入框
        $('[type="text"]').change(function(){
            var te=$(this).val();
            te=te.toString();
            for(i=0;i

四.css

< style type="text/css" >
*{
    font-size:12px;
}
< /style>

本章使用jQuery的方式实现了一个简易的商城系统,这一个比较潦草,明天再实现一个比较好看的.

到此这篇关于jQuery实现简易商城系统项目实操的文章就介绍到这了

 

关注
打赏
1665632672
查看更多评论
立即登录/注册

微信扫码登录

0.0376s