var text = String(fqterm.getSelect(false)); var url = String(fqterm.getURL()); /* var sharejs = '\n' + '\n' + '
\n' + '\n' + '\n' + '\n' + "\n \n \n"; fqterm.writeFile("tmp.html", sharejs); */ var picUrl = ""; var pattern = new RegExp('.+\\.(png|jpg|gif|bmp)$', 'i'); if (pattern.test(url)) { picUrl = url; } else { text = text + ' ' + url; } shareurl = 'http://v.t.sina.com.cn/share/share.php?title=' + encodeURIComponent(removeSpecial(text)); shareurl= shareurl + '&pic=' + encodeURIComponent(picUrl); shareurl= shareurl + '&ralateUid=2868108420&url=' + encodeURIComponent("D:\Test\test.html"); fqterm.openUrl(shareurl); function removeSpecial(str) { var res = str.replace(/"/g, '\\\"'); res = res.replace(/'/g, '\\\''); res = res.replace(/\\/g, '\\\\'); res = res.replace(/\n/g, ' '); res = res.replace(/\r/g, ''); return res; }