小编1BJ*_*903的帖子

没有www的Javascript location.host

我有一个php文件,用于在Facebook和Twitter上分享我的用户的帖子.例如,如果我点击Twitter图标,我会看到一个屏幕,其中自动编写了指向我网站的超链接.这很好,但我想删除www.自动显示在Twitter屏幕上的网址部分.我想这与location.host有关,所以我用Google搜索,但我找不到这个问题的正确答案.

这是我的代码示例:

function e(f,i,an)
{
        with(document)
        {
                write('<div style="width:100%"><table id=m'+i+' style="visibility:hidden"><tr>');
                write('<td id="vst' + i + '" style="white-space:nowrap">&nbsp;</td>');
                write('<td hr(this.childNodes[0])" title="share on facebook"><a href="javascript:od(\'http://www.facebook.com/sharer.php?u=' + location.host + '/e/'+ i +'\',900,400)" class=icon><img src="images/facebook.png" target="_blank"></a></td>');
        write('<td hr(this.childNodes[0])" title="share on twitter"><a href="javascript:od(\'http://twitter.com/home?status=' + location.host + '/e/'+ i +' - %20read!\',800,600)" class=icon><img src="images/twitter.png" target="_blank"></a></td>');
                write('<td class=ei><a name="cid'+i+'"></a><a href="e/'+i+'">( #'+i+' )</a></td>'); 

                  document.write('<td>&nbsp;</td>');
Run Code Online (Sandbox Code Playgroud)

我的第二个问题是:如何在Twitter屏幕上添加自定义标题:例如,我的网站名称,而不必将location.host与正在共享的TOPICNAME的标题一起使用?

javascript

7
推荐指数
2
解决办法
6065
查看次数

参数列表后缺少")"

我似乎找不到解决这个问题的方法:

 missing ) after argument list
[Break On This Error]   

}});
Run Code Online (Sandbox Code Playgroud)

这是提到的文件:

jQuery(document).ready(function() {
                    for (i=0;i<40;i++) {
            var w = 14 * (parseInt(Math.random() * 3) + 1) - 1,
                h = 28 * (parseInt(Math.random() * 3) + 1) - 1;
        jQuery('').width(w).height(h).appendTo('article');
        }

            jQuery('#content').freetile();
             selector: 'article';
            });
Run Code Online (Sandbox Code Playgroud)

我尝试在最后添加一个荣誉,但它没有用.有人可以帮帮我吗?

javascript arguments

0
推荐指数
1
解决办法
159
查看次数

标签 统计

javascript ×2

arguments ×1