1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
| <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> .buy_now { text-decoration: none; font-weight: 700; margin-right: 10px; display: inline-block; text-align: center; vertical-align: middle; background-color: #df3033; color: #fff; } </style>
<link href="/Css/tableStyle.css" rel="stylesheet" /> <script src="/js/jquery-1.7.1.js"></script> <script src="/ckeditor/ckeditor.js"></script> <link href="/Css/themes/ui-lightness/jquery-ui-1.8.2.custom.css" rel="stylesheet" /> <script src="/js/jquery-ui-1.8.2.custom.min.js"></script> <script type="text/javascript"> $(function () { $("#btnAdd").click(function () { AddComment(); }); LoadComment(); LoadBBCode(); $("#addCart").click(function () {
AddProductCart(); }); }); function AddProductCart() { $.post("/ashx/ProcessCart.ashx", { "bookId": $bookId }, function (data) { var serverData = data.split(':'); if (serverData[0] == "ok") {
$("#msg").text(serverData[1]); $("#showResult").css("display", "block"); $("#showResult").dialog({ height: 260, width: 300, modal: true, buttons: { ok: function () { $(this).dialog("close");
} } })
} else if (serverData[0] == "no") { } else { ShowLoginDialog(); } });
} function ShowLoginDialog() { $("#loginDiv").css("display", "block"); $("#loginDiv").dialog({ height: 260, width: 350, modal: true, buttons: { ok: function () { var txtUserName = $("#txtUserName").val(); var txtPwd = $("#txtPwd").val(); $.post("/ashx/Login.ashx", { "txtUserName": txtUserName, "txtPwd": txtPwd }, function (data) { if (data == "ok") { alert("登录失败,请输入正确的用户名和密码!"); } else { $(this).dialog("close"); alert(data); window.location.href = "/shoppingCart/shoppingCart.aspx"; } }); } } }) } function LoadBBCode() { CKEDITOR.replace('txtContent', { extraPlugins: 'bbcode', removePlugins: 'bidi,button,dialogadvtab,div,filebrowser,flash,format,forms,horizontalrule,iframe,indent,justify,liststyle,pagebreak,showborders,stylescombo,table,tabletools,templates', toolbar: [ ['Source', '-', 'Save', 'NewPage', '-', 'Undo', 'Redo'], ['Find', 'Replace', '-', 'SelectAll', 'RemoveFormat'], ['Link', 'Unlink', 'Image'], '/', ['FontSize', 'Bold', 'Italic', 'Underline'], ['NumberedList', 'BulletedList', '-', 'Blockquote'], ['TextColor', '-', 'Smiley', 'SpecialChar', '-', 'Maximize'] ], smiley_images: [ 'regular_smile.gif', 'sad_smile.gif', 'wink_smile.gif', 'teeth_smile.gif', 'tounge_smile.gif', 'embaressed_smile.gif', 'omg_smile.gif', 'whatchutalkingabout_smile.gif', 'angel_smile.gif', 'shades_smile.gif', 'cry_smile.gif', 'kiss.gif' ], smiley_descriptions: [ 'smiley', 'sad', 'wink', 'laugh', 'cheeky', 'blush', 'surprise', 'indecision', 'angel', 'cool', 'crying', 'kiss' ] }); } function LoadComment() { $.post("/ashx/BookComment.ashx", { "action": "load", "bookId": $bookId }, function (data) { var serverData = $.parseJSON(data);
var serverDataLength = serverData.length; for (var i = 0; i < serverDataLength; i++) { $("<li>" + serverData[i].ShowTime + ":" + serverData[i].Msg + "</li>"). appendTo("#commentList"); }
}) } function AddComment() { var oEditor = CKEDITOR.instances.txtContent; var msg = oEditor.getData(); if (msg != null) { $.post("/ashx/BookComment.ashx", { "action": "add", "msg": msg, "bookId": $bookId }, function (data) { var serverData = data.split(':'); if (serverData[0] == "ok") { oEditor.setData(""); $("#txtContent").focus(); $("#txtMsg").text(serverData[1]); } else { $("#txtMsg").text(serverData[1]); } }); } else { $("#txtMsg").text("评论不能为空"); $("#txtContent").focus(); } } </script> </head> <body> <table> <tr><td>书名</td><td>$title</td></tr> <tr><td>作者</td><td>$author</td></tr> <tr><td>单价</td><td>$unitprice <a href="javascript:void(0)" class="buy_now" id="addCart">加入购物车</a></td></tr> <tr><td>封面</td><td><img src="/Images/BookCovers/$isbn.jpg" /></td></tr> <tr><td>简介</td><td>$content</td></tr> </table> <hr /> <ul id="commentList" class="comments"></ul> <textarea id="txtContent" rows="10" cols="100" class="reply_box" placeholder="用什么感谢?留下吧…………"></textarea>
<input type="button" value="发布评论" id="btnAdd" class="reply_btn" /><span id="txtMsg" style="font-size:20px;color:yellow"></span> <div id="loginDiv" style="display:none;" title="登录" > <strong style="margin-top:20px;">用户名:</strong><input type="text" id="txtUserName" style="margin-top:20px;"/><br /> <strong style="margin-top:10px;">密 码:</strong><input type="password" id="txtPwd" style="margin-top:10px;"/><br /> </div> <div id="showResult" style="display:none"> <span id="msg"></span>访问<a style="font-size:20px;color:red" href="/shoppingCart/shoppingCart.aspx">购物车</a>页面,进行支付 </div> </body> </html>
|