我有以下 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
我的功能有什么错误吗?