$('#myDiv').fadeOut().html('帅哥, 你好!').fadeIn();
myStr1.replace('k', 'R').toUpperCase().substr(0,4);
var usresData = [
{firstName: 'Zhang', lastName: 'San', email: '111@qq.com', id: 102},
{firstName: 'Li', lastName: 'Si', email: '222@qq.com', id: 103},
{firstName: 'Wang', lastName: 'Wu', email: '333@qq.com', id: 105}
];
function getCaseName(str) {
return str.replace(/\w\S*/g, function(txt){
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
})
}
var userController = {
currentUser = '',
findUser = function (userEmail) {
var arrayLength = usersData.length, i;
for (i = arrayLength - 1; i >= 0; i--) {
if (usersData[i].email === userEmail) {
this.currentUser = usersData[i];
break;
}
}
return this;
},
formatName: function () {
if (this.currentUser) {
this.currentUser.fullName = getCaseName(this.currentUser.firstName) + ' ' + getCaseName(this.currentUser.lastName);
}
return this;
},
createLayout: function () {
if (this.currentUser) {
this.currentUser.viewData = '<h2>成员: ' + this.currentUser.fullName + '</h2>'
+ '<p>ID: ' + this.currentUser.id + '</p>' + '<p>Email: ' + this.currentUser.email + '</p>';
}
return this;
},
displayUser: function () {
if (!this.currentUser) return;
$('.members-wrapper').append(this.currentUser.viewData);
}
}
userController.findUser('111@qq.com').formatName().createLayout().displayUser();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有