js的无限级菜单

2010年06月03日

以下实现,理论上讲是可以无限的,没有测具体到哪个级别会出问题

数据库有一个类表,
字段说明如下:
id:类id
fid:父类id
lid:所属层级
cname:名称

通过程序输出职下数据:

var menuarr=[
	["菜单一",1,0,0],
	["菜单二",2,0,0],
	["菜单三",3,5,0],
	["菜单四",4,1,1],
	["菜单五",5,1,1],
	["菜单六",6,2,1],
	["菜单七",7,4,2],
	["菜单八",8,3,1],
	["菜单九",9,5,2],
	["菜单十",10,4,2],
	["菜单十一",11,4,2]
];

即:[类名,类id,父id,层级]
阅读这个条目剩下部分 »

一些获取数据的地方

2010年06月03日

http://www.webxml.com.cn/

提供以下服务:

400个国内外主要城市天气预报Web服务  
IP地址来源搜索 WEB 服务(是目前最完整的IP地址数据)  
随机英文、数字和中文简体字 WEB 服务  
中国邮政编码 <-> 地址信息双向查询/搜索 WEB 服务  
验证码图片 WEB 服务 支持中文、字母、数字  
Email 电子邮件地址验证 WEB 服务  
中文简体字<->繁体字转换 WEB 服务  
中文 <-> 英文双向翻译 WEB 服务  
火车时刻表 WEB 服务 (第六次提速最新列车时刻表)  
中国股票行情数据 WEB 服务(支持深圳和上海股市的基金、债券和股票)  
即时外汇汇率数据 WEB 服务  
腾讯QQ在线状态 WEB 服务  
中国电视节目预告(电视节目表) WEB 服务  
外汇-人民币即时报价 WEB 服务  
中国股票行情分时走势预览缩略图 WEB 服务  
国内飞机航班时刻表 WEB 服务  
中国开放式基金数据 WEB 服务  
股票行情数据 WEB 服务(支持香港、深圳、上海基金、债券和股票;支持多股票同时查询)  
2500多个城市天气预报 WEB服务  
国内手机号码归属地查询WEB服务  
[新] 中文<->英文双向翻译WEB服务  

 

http://api.liqwei.com/

提供的服务有:

实用号码归属地查询(IP 地址,手机号码):
默认格式: http://api.liqwei.com/location/ (使用来访者的 IP 地址)
指定 IP 地址格式: http://api.liqwei.com/location/?ip=202.108.33.32 (新浪的IP)
指定手机号码格式: http://api.liqwei.com/location/?mobile=13800138000 (北京的号码)
可选参数: js:【js 输出】,默认为 0,可选值:1,0
备注: UTF-8 编码支持的格式:http://api.liqwei.com/location/utf8/ 其它参数不变;
城市天气情况查询:
默认格式: http://api.liqwei.com/weather/ (使用来访者的 IP 地址)
指定 IP 地址格式: http://api.liqwei.com/weather/?ip=202.108.33.32 (新浪的IP)
指定手机号码格式: http://api.liqwei.com/weather/?mobile=13800138000
指定城市名称格式: http://api.liqwei.com/weather/?city=北京

阅读这个条目剩下部分 »

在你的WEB项目中应用XCSS

2010年05月27日

先看一段代码:

vars{
	$width=500px;
	$topheight=90px;
	$color=#333;
	$mainbgcolor=#fff;
	$topbgcolor=#666;
	$border = border-top: 1px solid #ccc;
}
#wrap{width:$width;$border}
#top{height:$topheight;background:$topbgcolor}

注意到 vars{} 标签
这就是简单的XCSS语法
我认为的好处:
使编写CSS条理更清晰,更有面象对象的感觉
可以在输出css时,自动处理掉多余的空格、换行等

下载:http://xcss.antpaw.org/
使用方法:
将下载的压缩包压到你的网站,比如我的是 /template/xcss
然后在你的页面中用script引入:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
	<title></title>
	<script type="text/javascript" src="/template/xcss/"></script>
	<link rel="stylesheet" type="text/css" href="/template/default/master.css"/>
</head>
<body>
	<div id="wrap">

		<div id="top"></div>
		<div id="middle"></div>
		<div id="bottom"></div>
	</div>
</body>
</html>

配置XCSS中的config.php文件,配置需要加载的css文件
默认的设置中 会自动生成 master.css
所以你的页面只要引用一个master.css文件,后台的多个Css都交给XCSS去自动加载

在线的范例:http://www.lingye.net/xcss.html

Android 2.2 尝鲜

2010年05月24日

从CM5.06直接下载2.2 for rooted 安装包刷机成功

主界面:

阅读这个条目剩下部分 »

IE全测试 Internet Explorer Collection

2010年05月19日

Internet Explorer Collection
一个IE全面测试工具,内含 Internet Explorer Developer Toolbar 1.00.2188.0

支持以下IE版本:
•Internet Explorer 1.0 (4.40.308)
•Internet Explorer 1.5 (0.1.0.10)
•Internet Explorer 2.01 (2.01.046)
•Internet Explorer 3.0 (3.0.1152)
•Internet Explorer 3.01 (3.01.2723)
•Internet Explorer 3.03 (3.03.2925)
•Internet Explorer 4.01 (4.72.3110.0)
•Internet Explorer 5.01 (5.00.3314.2100)
•Internet Explorer 5.5 (5.51.4807.2300)
•Internet Explorer 6.0 (6.00.2800.1106)
•Internet Explorer 6.0 (6.00.2900.2180)
•Internet Explorer 7.0 (7.00.5730.13)
•Internet Explorer 8.0 (8.00.6001.18702)

下载地址1:http://codecpack.nl/iecollection1606.exe
国内下载:http://www.onlinedown.net/soft/71978.htm

overflow的用处

2010年05月18日

除了清除溢出
overflow还有别的用处
当一个块状元素设置了overflow属性(auto或hidden),当它的尺寸没指定时,尺寸会随着内部元素的尺寸变化而变化

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>overflow</title>
	</head>
	<body>
		<style type="text/css">
			#box{overflow:hidden;background:#fff;border:1px solid #666;width:300px;}
		</style>
		<div id="box">
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
				<p>&nbsp;test</p>
		</div>
	</body>
</html>

CSS框架

2010年05月18日

基于css实现的网页框架效果
效果见:http://www.lingye.net/demo/css-frame/index.html

原文:http://www.456bereastreet.com/archive/200609/css_frames_v2_fullheight/

Nginx的泛域名解析

2010年05月13日
        server{
                listen          80;
                server_name     *.1988m.com;
                server_name_in_redirect off;
                access_log      logs/f1988m.access.log main;
                error_page 403  /403.html;
                error_page 404  /404.html;
                error_page 502  /502.html;
                #默认目录
                set $rootdir /Data/webapps/f1988m;

                location / {
                        index   index.htm index.html index.php;
                        #默认目录
                        #set $rootdir /Data/webapps/f1988m;
                        #匹配二级域名
                        if ($host ~* ^([^\.]+)\.([^\.]+)\.([^\.]+)$) {
                                set $aname $1;
                        }
                        if ($aname ~* ^img$) {
                                set $rootdir /Data/webapps/f1988m/imgfile;
                        }
                        if ($aname ~* ^s2$) {
                                set $rootdir /Data/webapps/s2;
                        }
                        if ($aname ~* ^www$) {
                                set $rootdir /Data/webapps/f1988m/www;
                        }
                        root    $rootdir;
                }
                #静态文件缓存时间设置
                 location ~* ^.+img\.1988m\.com/.+\.(gif|jpg|jpeg|png|bmp|ico|swf)$ {
                        root $rootdir;
                        expires 7d;
                        add_header Vary Accept-Encoding;
                }
                location ~ \.php$ {
                        root            $rootdir;
                        fastcgi_pass    127.0.0.1:9000;
                        fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                        fastcgi_param  REQUEST_METHOD   $request_method;
                        fastcgi_param  CONTENT_TYPE     $content_type;
                        fastcgi_param  CONTENT_LENGTH   $content_length;
                        include        fastcgi_params;
                }

}

要求符合的条件:
所操作的域名支持泛解析,即支持*为值的A记录。

测试:
http://abcde.1988m.com
http://img.1988m.com/404

约会流程图

2010年05月13日

c# 的 HTTP操作

2010年05月11日
#region HTTP操作
        /// <summary>
        /// 模拟HTTP请求,如模拟请求来源,用户UA及Cookies
        /// </summary>
        /// <param name="url">请求地址</param>
        /// <param name="encoding">请求编码</param>
        /// <param name="requesttype">请求类型</param>
        /// /// <param name="returntype">返回类型</param>
        /// <param name="requestdata">请求数据</param>
        /// <param name="referer">请求来源</param>
        /// <param name="user_agent">用户ua</param>
        /// <param name="cookiestr">cookies,形如:"uuauth=ok; ss=1;"</param>
        /// <returns>请求得到的html文本</returns>
        public static HttpWebResponse MyHttpRequest(string url, string encoding, string requesttype, string returntype, string requestdata, string referer, string user_agent, string cookiestr)
        {
            try
            {
                HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(url);
                myReq.Referer = referer;
                myReq.Method = requesttype;
                myReq.UserAgent = user_agent;
                myReq.ContentType = returntype;
                myReq.Headers.Add(HttpRequestHeader.Cookie, cookiestr);
                if (requesttype.ToLower() == "post")
                {
                    myReq.ContentType = "application/x-www-form-urlencoded";
                    myReq.Headers.Add("Cache-Control", "no-cache");
                    byte[] bytes = Encoding.GetEncoding(encoding).GetBytes(requestdata);
                    myReq.ContentLength = bytes.Length;
                    Stream oStreamOut = myReq.GetRequestStream();
                    oStreamOut.Write(bytes, 0, bytes.Length);
                    oStreamOut.Close();
                }
                HttpWebResponse response = myReq.GetResponse() as HttpWebResponse;
                return response;
            }
            catch
            {
                return null;
            }
        }

        #endregion

调用

                HttpWebResponse httpresponse = MyHttpRequest("http://owned.kaixin.com/getPhoto.do", "utf-8", "post", "text/html", "id=703953558&pid=703354897", "http://owned.kaixin.com/getPhoto.do", "Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7", cookiestr);
                StreamReader outstr = new StreamReader(httpresponse.GetResponseStream(), Encoding.GetEncoding("utf-8"));
                string htmltext = outstr.ReadToEnd();
                outstr.Dispose();
                httpresponse.Close();

基于以上函数的一个小工具(源码):
http://www.lingye.net//blog/wp-content/uploads/LYHTTPHelper.zip

© 2008 零叶亭. Some Rights Reserved.
京ICP备09046320号
Powered by WordPress 2.9.2. Theme LYStyle by lingye.net.