Archive for category Web方向

innerHTML属性在chrome浏览器下取不到input value值的解决方案

$(function () {
            if (!$.browser.msie)
                $("input:text").each(function () {
                    var input_id = $(this).attr('id');
                    document.getElementById(input_id).addEventListener("keyup", function () {
                        document.getElementById(input_id).setAttribute("value", document.getElementById(input_id).value);
                    }, false);
                });
        });

要用脚本手动的设属性到input中去,而这个过程在ie下是自动完成的,chrome却不是。

金格控件加水印

function WaterMark(WordObject){
  WordObject.Application.Selection.HeaderFooter.Shapes.AddTextEffect(0, "金格控件水印", "宋体", 1, false, false, 0, 0).Select();
  WordObject.Application.Selection.ShapeRange.TextEffect.NormalizedHeight = false;
  WordObject.Application.Selection.ShapeRange.Line.Visible = false;
  WordObject.Application.Selection.ShapeRange.Fill.Visible = true;
  WordObject.Application.Selection.ShapeRange.Fill.Solid();
  //填充色 为十进制颜色
  WordObject.Application.Selection.ShapeRange.Fill.ForeColor.RGB = 10444703;
  WordObject.Application.Selection.ShapeRange.Fill.Transparency = 0;
  //0表示水平 315倾斜45度
  WordObject.Application.Selection.ShapeRange.Rotation = 315;
  WordObject.Application.Selection.ShapeRange.LockAspectRatio = true;
  WordObject.Application.Selection.ShapeRange.Height= WordObject.Application.CentimetersToPoints(4.92);
  WordObject.Application.Selection.ShapeRange.Width= WordObject.Application.CentimetersToPoints(19.69);
  WordObject.Application.Selection.ShapeRange.WrapFormat.AllowOverlap = true;
  WordObject.Application.Selection.ShapeRange.WrapFormat.Side = 3;
  WordObject.Application.Selection.ShapeRange.WrapFormat.Type = 3;
  WordObject.Application.Selection.ShapeRange.RelativeHorizontalPosition = 0;
  WordObject.Application.Selection.ShapeRange.RelativeVerticalPosition = 0;
  WordObject.Application.Selection.ShapeRange.Left = -999995;
  WordObject.Application.Selection.ShapeRange.Top = -999995;
  WordObject.Application.ActiveWindow.ActivePane.View.SeekView = 0;
}

刷新父页面,关闭窗口不提示的脚本

try{opener.location.href=opener.location.href;}catch(e){};
window.opener=null;window.open('','_self');window.close();

在wordpress中增加分享到QQ空间等的功能

现在越来越多的平台都支持分享功能了,比如将一篇wordpress中的文章分享到读者的QQ空间。腾讯开放平台的地址为:分享组件,只需要将代码放到wordpress中即可。但除了QQ空间以外,还有人人网、新浪微博等,如果一个一个的找代码来做是不是太麻烦呢?

现在只需要按以下步骤,就可以在你的wp中实现分享到的功能了。

首先是进入wp的站点管理,在“外观”–“编辑”里面,打开“single.php”,然后将以下代码复制到你需要放的位置上:

<div class="share clearfix">
    <span class="txt">分享到:</span>
    <span>
        <a class="t_qq" href="javascript:(function(){window.open('http://v.t.qq.com/share/share.php?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(location.href)+'&source=bookmark','_blank','width=610,height=350');})()"
            title="分享到QQ微博">QQ微博</a>
    </span>
    <span>
        <a class="sina" title="分享到新浪微博" href="javascript:void((function(s,d,e){try{}catch(e){}var f='http://v.t.sina.com.cn/share/share.php?',u=d.location.href,p=['url=',e(u),'&title=',e(d.title),'&appkey=2924220432'].join('');function a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=620,height=450,left=',(s.width-620)/2,',top=',(s.height-450)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));">
            新浪微博
        </a>
    </span>
    <span>
        <a href="http://twitter.com/home?status="
            <?php the_title(); ?> <?php the_permalink(); ?>"
            title="分享到Twitter" target="_blank" class="twitter">Twitter
        </a>
    </span>
    <span>
        <a class="renren"
                        href="javascript:void((function(s,d,e){if(/renren\.com/.test(d.location))return;var f='http://share.renren.com/share/buttonshare?link=',u=d.location,l=d.title,p=[e(u),'&title=',e(l)].join('');function%20a(){if(!window.open([f,p].join(''),'xnshare',['toolbar=0,status=0,resizable=1,width=626,height=436,left=',(s.width-626)/2,',top=',(s.height-436)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent));"
                        title="分享到人人网">人人网</a>
    </span>
    <span>
        <a class="qzone" href="javascript:void(window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href)));"
                            title="分享到QQ空间">QQ空间</a>
    </span>
</div>

可以参考我放的位置:31行后面回车,然后粘贴。

这是第一步,第二步要修改style.css文件,复制以下代码到style.css文件的最后面

/* 这是分享部分的样式代码 */
.clearfix:after{content:".";clear:both;height:0;visibility:hidden;display:block;}
.clearfix{display:inline-block;}
* html .clearfix{height:1%;}
.clearfix{display:block;}
.share{padding:15px 0;border-bottom:1px solid #cccccc;font-size:12px}
.share span{float:left;margin:0 15px 0 0;}
.share span.txt{margin:0;}
.share a{
	background:url("http://farm6.static.flickr.com/5300/5481118371_03f52aebe9_t.jpg") no-repeat 0 0;
	display:block;padding:0 0 0 18px;height:16px;line-height:16px;
	color:#0066CC;overflow:hidden;margin:2px 0 0;
	text-decoration:none;}
.share a:hover{color:#E05C23;}
.share .twitter{background-position:0 -16px;}
.share .renren{background-position:0 -32px;}
.share .qzone{background-position:0 -48px;}
.share .t_qq{background-position:0 -64px;}
/* 分享部分样式代码结束 */

保存之后,看看你的文章页面是不是增加了分享到的功能?

jquery收藏

Web开发者必知的12款jQuery插件

在网站中整合Discuz!NT

通常情况下,用户在网站注册用户以后,应该直接可以使用该用户登录论坛,但由于以往论坛都是从网上找来的程序直接部署的,用户这部分信息也一直没有很好的整合。而在Discuz!NT中,虽然开放了API,但也很难用,应该是不成熟,好在其代码开源了,也有人遇到了和我一样的需求,故在网上找到了一个贴子,在这里引用一下。http://nt.discuz.net/archiver/showtopic-73699.html

将页面中的内容导出到word

有的时候,调用网页的打印,客户端显示器的分辨率不同,打印出来的效果也不一样,所以,将要打印的内容导出到word中,然后再进行打印,就成为一个比较不错的选择。 Read the rest of this entry »

nginx在linux为何效率高?

答案:采用epoll的事件模型。

首先nginx支持一下这些事件模型(参考nginx的wiki) Read the rest of this entry »

Ajax状态值

0**:未被始化
1**:请求收到,继续处理
2**:操作成功收到,分析、接受
3**:完成此请求必须进一步处理
4**:请求包含一个错误语法或不能完成
5**:服务器执行一个完全有效请求失败

100——客户必须继续发出请求
101——客户要求服务器根据请求转换HTTP协议版本

200——交易成功
201——提示知道新文件的URL
202——接受和处理、但处理未完成
203——返回信息不确定或不完整
204——请求收到,但返回信息为空
205——服务器完成了请求,用户代理必须复位当前已经浏览过的文件
206——服务器已经完成了部分用户的GET请求[断点续传]
Read the rest of this entry »

高并发 高性能 高扩展性 Web 2.0 站点架构设计及优化策略[转]

资料收集:高并发 高性能 高扩展性 Web 2.0 站点架构设计及优化策略

最近专门花时间研究了一下高并发 高性能 高扩展性 Web 2.0 站点架构设计及优化策略,发现了很多不错的资料,继续跟大家分享。——对于期望在大型网络应用的性能测试和性能优化方面获得提高的朋友们来说,尤其应该认真看看。^_^
Read the rest of this entry »
pagepeel by webpicasso.de