js实现url的复制和jsp 获取地址栏的地址
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language='javascript'>
function copyToClipBoard(){
var clipBoardContent='';
clipBoardContent+=window.location;
window.clipboardData.setData("Text",clipBoardContent);
alert("你已复制链接及标题,请粘贴到POPO/MSN等发给好友!");
}
</script>
</HEAD>
<BODY>
<input title="点击复制标题和地址到剪贴版,直接在POPO/MSN上粘贴即可." type=button value="点击复制本网址,发给POPO/QQ/MSN好友共享" name="B3" οnclick="copyToClipBoard()">
</BODY>
</HTML>
jsp 获取地址栏的地址:
String url=request.getScheme()+"://";
url+=request.getHeader("host");
url+=request.getRequestURI();
if(request.getQueryString()!=null)
url+="?"+request.getQueryString();
String aa=request.getQueryString();
out.println(url);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language='javascript'>
function copyToClipBoard(){
var clipBoardContent='';
clipBoardContent+=window.location;
window.clipboardData.setData("Text",clipBoardContent);
alert("你已复制链接及标题,请粘贴到POPO/MSN等发给好友!");
}
</script>
</HEAD>
<BODY>
<input title="点击复制标题和地址到剪贴版,直接在POPO/MSN上粘贴即可." type=button value="点击复制本网址,发给POPO/QQ/MSN好友共享" name="B3" οnclick="copyToClipBoard()">
</BODY>
</HTML>
jsp 获取地址栏的地址:
String url=request.getScheme()+"://";
url+=request.getHeader("host");
url+=request.getRequestURI();
if(request.getQueryString()!=null)
url+="?"+request.getQueryString();
String aa=request.getQueryString();
out.println(url);