判断网页是否在IFRAME或FRAME中

判断网页是否在frame中:
if(top!=this){
// 在frame中时处理
}
判断网页是否在iframe中:
if(self.frameElement.tagName==”IFRAME”){
// 页面在iframe中时处理
}

Cookie跨域操作

正常的cookie只能在一个应用中共享,即一个cookie只能由创建它的应用获得。 (continue reading…)

1 Comment more...

深入理解session与cookie

1. 当第一次请求一个网站,网站返回有session时只返回session的ID。当再请求这个网站的任何页面,都会把session的ID发送到服务器,页面返回不再有session ID 。 (continue reading…)


密码保护:高性能系统的挑战在那里?

这是一篇受密码保护的文章,您需要提供访问密码:

要查看留言请输入您的密码。 more...

无限多级分类删除父id后子parent_id自动更新

删除一个分类以后,它的子分类的 parent_id 号就需要改变一下,而不能继续指向这个不存在的分类,因此我希望删除这个分类以后,它的子分类的父分类变为它的父分类。

lock tables `categories` write, `categories` as `c1` write,   `categories` as `c2` write;

update `categories` as `c1`, `categories` as `c2` set `c1`.`parent_id` = `c2`.`parent_id` where `c1`.`parent_id` = `c2`.`cat_id` and `c2`.`cat_id` = $cat_id;

delete from `categories` where `cat_id` = $cat_id;

unlock tables;

这里需要注意的一点是,锁定表的时候,一定要把要操作的表和Mysql表别名都锁定,否则下面的语句会出错.

demo

c1 (new)
uid     parent_id
1         0
2        1
3        2
4        3
res
1        0
3        1
4        3
c2 (old)
uid    parent_id
1        0
2        1
3        2
4        3
where条件查询结果c1为 3   2,c2为2  1,set之后结果就是res里的3  1.

TCA – color picker

The colorpicker wizard allows you to select a HTML color value from a user-friendly pop-up box. The wizard type is “colorbox” which will first of all add a colored box next to an input field. Here’s how it looks in a “haiku” record of the “examples” extension:

onefunction (color) (continue reading…)


JavaScript数组去掉重复

引用Ext中实现方法:

Java代码
  1. unique: function( array ) { (continue reading…)

eventKey code

function checkNumber(event,objThis)
{
	var eventKey = document.all ? event.keyCode : event.which;
	if(!(eventKey>=48&&eventKey<=57) && eventKey != 8 )
		return false;
}
<input type="text" size="4" maxlength="4" value="2" name="count" onkeypress="return checkNumber(event,this);">
1 Comment more...

text-indent 隐藏按钮文字

1: HTML Code

Create a HTML page and insert a button with a class, “button”. (continue reading…)


ie6 下 jquery的 submit不起作用

  • 问题:
  • 项目中所有使用jquery.submit()的方法在验证后提交在ie6中失去作用;
  • 所有使用window.location.href=*** 方法在验证后在ie6中失去作用;
  • 所有a链接中使用href=”javascript:void(0);”方法后在i6中点击失去使用;
  • (失去作用意思为:点击后已经到后台取到值但页面并没有更新) (continue reading…)

Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress