<!DOCTYPE html> <html> <head> <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <meta charset="UTF-8"> <title>Document</title> <!-- <style type="text/css"> ul{list-style:none} </style> --> </head> <body> <div > <h3>购物清单</h3> <hr> <ul> <li>夏进牛奶3.9元/瓶</li> <li>好丽友4.5元/盒</li> </ul> <p>应收金额:102.8元</p> </div> <script type="text/javascript"> var ul=document.getElementsByTagName('ul')[0] var li1=document.createElement('li') li1.innerHTML='老干妈4.5元/瓶' li1.id='iteml' ul.appendChild(li1) $('div').css({ 'width':'170px', 'height':'300px', 'color':'green', 'margin':'0 auto', 'margin-top':'40px', 'text-align':'center', 'border':'1px solid #333', 'box-shadow':'5px 5px 3px #888' }) $('ul').css('list-style','none') $('ul').css('padding-left','0') var li2=$('<li>') li2.html('可比克7.5元/桶') li2.attr('id','item2') li2.appendTo('ul') li2.prepend('<li style="color:red">安慕希66元/箱</li>') li2.append('<li style="color:red">喜之郎4.5元/箱</li>') var li3=$('<li id="item3">阿香婆11.5元/瓶</li>') li3.prependTo('ul') li3.after('<li style="color:red">豆干9.3元/瓶</li>') li3.before('<li style="color:red">消毒液2.6元/瓶</li>') </script> </body> </html>