页面跳转时解析url中携带的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var urlinfo =window.location.search;
urlinfo=decodeURIComponent(urlinfo)
var r = urlinfo.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
}
获取选中的文本
function getSelectedText() {
var txt = "";
if (window.getSelection) {
txt = window.getSelection().toString();
} else if (window.document.getSelection) {
txt = window.document.getSelection();
} else if (window.document.selection) {
txt = window.document.selection.createRange().text;
}
return txt;
}