//初始化页面时验证是否记住了密码
$(document).ready(function() {
if ($.cookie("rmbUser") == "true") {
$("#rmbUser").attr("checked", true);
$("#user").val($.cookie("userName"));
$("#pass").val($.cookie("passWord"));
}
});
//保存用户信息
function saveUserInfo() {
if ($("#rmbUser").attr("checked") == true) {
var userName = $("#user").val();
var passWord = $("#pass").val();
$.cookie("rmbUser", "true", { expires: 7 }); // 存储一个带7天期限的 cookie
$.cookie("userName", userName, { expires: 7 }); // 存储一个带7天期限的 cookie
$.cookie("passWord", passWord, { expires: 7 }); // 存储一个带7天期限的 cookie
}
else {
$.cookie("rmbUser", "false", { expires: -1 });
$.cookie("userName", '', { expires: -1 });
$.cookie("passWord", '', { expires: -1 });
}
}
class HtmlOutputer(object):
def __init__(self):
self.datas = []
def collect_data(self,data):
if data is None:
return
self.datas.append(data)
def output_html(self):
# print(self.datas)
fout = open('output.html',"w")
fout.write("<html>")
fout.write("<body>")
fout.write("<table>")
for data in self.datas:
# print(data['url'])
# print(data['title'])
# print(data['summary'])
fout.write("<tr>")
fout.write("<td>%s</td>" % data['url'].encode('utf-8').decode("utf-8"))
fout.write("<td>%s</td>" % data['title'].encode('utf-8').decode("utf-8"))
# fout.write("<td>%s</td>" % data['summary'].encode('utf-8').decode("utf-8"))
fout.write("</tr>")
fout.write("</table>")
fout.write("</body>")
fout.write("</html>")