var myName = '<你的昵称>';
var myEmail = '<你的邮箱地址>';
var myUrl = '<你的Blog地址,可不填>';
function fillForm(blogIdSelector, authorSelector, urlSelector, emailSelector) {
if (blogIdSelector != null) {
var blogId = document.querySelector(blogIdSelector);
if (blogId == null) {
return false;
}
}
var author = document.querySelector(authorSelector);
if (author == null) {
return false;
}
author.setAttribute('value', myName);
var url = document.querySelector(urlSelector);
if (url != null) {
url.setAttribute('value', myUrl);
}
var email = document.querySelector(emailSelector);
if (email == null) {
return false;
}
email.setAttribute('value', myEmail);
return true;
}
var blogList = {
'wordpress': function() {return fillForm('#commentform', '#author', '#url', '#email');},
'typecho': function() {return fillForm('#comment_form', '#author', '#url', '#mail');},
'z_blog': function() {return fillForm('#frmSumbit', '#inpName', '#inpHomePage', '#inpEmail');},
'emlog': function() {return fillForm('#commentform', 'input[name="comname"]', 'input[name="comurl"]', 'input[name="commail"]');}
};
for (var i in blogList) {
if (blogList[i]()) {
break;
}
}

感谢作者:幻杀博客的投稿,欢迎大家投稿: https://www.blogs.hk/post-87.html
相关阅读
留言咨询