在Facebook和Twitter上分享个人资料链接

Profile Link Sharing in Facebook and Twitter

本文关键字:分享 个人资料 链接 Twitter Facebook      更新时间:2023-09-26

我有以下JavaScript代码用于在Facebook和Twitter中共享链接。

<script type="text/javascript">
 function show_fb(id)
 {
 alert('http://www.facebook.com/sharer.php?u=
 http://devel.testingsite.biz/testxxxxx.php?cmd=profile&id='+id+'');
 u=location.href;
 t=document.title;window.open('http://www.facebook.com/sharer.php?u={https_server}testxxxxx.php?cmd=profile&id='+id+'','sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
 </script>

在 HTML 端,它如下所示:

 <li><a href="javascript:void(0)" onclick="show_fb({uid});" class="icon_h3"></a></li>

好吧,该功能正在工作,它显示了共享窗口,但是我要共享的链接是没有id的链接

http://devel.testingsite.biz/testxxxxx.php?cmd=profile

但是在警报功能中打印时相同的链接会显示id(如下所示)。我需要提供以下链接。

http://devel.testingsite.biz/testxxxxx.php?cmd=profile&id=645

我的函数有什么错误吗?

你能试试这个吗?

    <script type="text/javascript">
 function show_fb(id)
 {
 alert("http://www.facebook.com/sharer.php?u=
 http://devel.testingsite.biz/testxxxxx.php?cmd=profile&id='+id+'");
 u=location.href;
 t=document.title;
window.open("http://www.facebook.com/sharer.php?u={https_server}testxxxxx.php?cmd=profile&id='+id+'','sharer','toolbar=0,status=0,width=626,height=436");
return false;
}
 </script>