Tôi không biết đủ về javascript để tìm ra lý do tại sao dòng trong tập lệnh này bắt đầu "window.open ..." ném lỗi đối số không hợp lệ trong IE7- 8-9b. Hoạt động tốt trong Firefox và Webkit.window.open ném đối số không hợp lệ trong IE7-8-9b
(Tập lệnh được ghim với một onclick="share.fb()"
trong liên kết html và bật lên một cửa sổ trình duyệt mới để chia sẻ tại FB và Twitter).
var share = {
fb:function(title,url) {
this.share('http://www.facebook.com/sharer.php?u=##URL##&t=##TITLE##',title,url);
},
tw:function(title,url) {
this.share('http://twitter.com/home?status=##URL##+##TITLE##',title,url);
},
share:function(tpl,title,url) {
if(!url) url = encodeURIComponent(window.location);
if(!title) title = encodeURIComponent(document.title);
tpl = tpl.replace("##URL##",url);
tpl = tpl.replace("##TITLE##",title);
window.open(tpl,"sharewindow"+tpl.substr(6,15),"width=640,height=480");
}
};
Bạn đã thử chuyển đổi các 'this.share' cho 'share.share' trong những' fb' và 'tw' chức năng? – sdleihssirhc