解决javascript无法使用submit方法提交表单问题

发布于 w3c | 2008-06-11 | 3 Comments »

之前在使用javascript处理一个form的时候,发现无法使用submit方法来提交表单,firebug提示方法submit不存在.最后发现,form中提交的input设定了name=”submit”的属性,删除后问题解决.

由于input的name属性存在,导致document.form.submit被错误定位到input元素上,造成错误.

Tags: , ,

Wordpress 指定某个分类的文章到首页显示

发布于 WordPress | 2008-06-06 | 3 Comments »

// Get the last 10 posts in the special_cat category.
<?php query_posts('category_name=special_cat&showposts=10'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Do special_cat stuff... -->
<?php endwhile;?>

注意,category_name要对应后台中Category Slug中的内容,而非Category Name.

六一快乐…

发布于 My Life | 2008-06-02 | 没有评论 »

完全已经过了过六一的年龄…

但是昨晚还是小疯了一下…

3个无聊的小孩…我就不说什么了…

最终以俺惨败结束…

http://pk.6.cn/

http://pk.6.cn/show.php?id=591

http://pk.6.cn/show.php?id=594

Tags: ,

nginx:轻量高效的web服务器

发布于 IT | 2008-06-01 | 4 Comments »

今天把服务器上的apache换成了nginx,以nginx+fastcgi模式来执行php,结果效果完全超乎想像.

GH的wordpress首页执行时间,又原来的0.6xx秒,下降到0.2xx秒,本博的首页执行时间由0.3s降为0.1s.

早听闻nginx十分高效,但是这个结果,还是令我十分吃惊.

另外附上张宴老师的nginx配置文章:http://blog.s135.com/read.php/314.htm

Tags:

兼容XMLHttpRequest实例化函数.

发布于 w3c | 2008-05-30 | 3 Comments »

function getXmlHttp(){
try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e)
{
xmlhttp = null;
}
}
if (xmlhttp==null && typeof XMLHttpRequest!="undefined"){
try
{
xmlhttp=new XMLHttpRequest();
xmlhttp.overrideMimeType('text/xml');
}catch(e){
xmlhttp=false;
}
}
return xmlhttp;
}

以上函数是我最近一次实例XMLHttpRequest的方法.

早先进行实例的时候,是先处理支持XMLHttpRequest类的标准浏览器,再处理IE这种使用ActiveX实现XMLHttpRequest.

但是前几天发现,似乎IE7已经开始支持XMLHttpRequest,但是使用工程中有发现有点问题,就有改了一下,使用上面这个函数来获取XMLHttpRequest支持.

Tags: , , ,