置顶随笔

[置顶]彭成刚 博客园 技术索引贴 置顶!

摘要: 把常用的都放首页上来。。就不用每次都要翻页找半天了~~ppRoll4.js 最新滚动插件 用json结构做的http://www.cnblogs.com/pengpengsay/archive/2010/04/21/1717440.html新做的焦点图js组件 focus1.js 用json传参http://www.cnblogs.com/pengpengsay/archive/2010/04/2...阅读全文

posted @ 2010-06-29 14:39 彭成刚 阅读(99) 评论(0) 编辑

2012年1月11日

js动画脚本编写原理 最简单的那种

用到了透明度 做的时候发现 透明度的调节 需要指定宽高,要不然透明度的数值就无效了。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
window.onload = function()
{
	var k = document.getElementById("k");
	k.onmouseover = function()
	{
		clearInterval(this.goObj);
		this.style.opacity=1;
		this.style.filter="alpha(opacity=100)";
	};
	k.onmouseout = function()
	{
		this.style.opacity=1;
		this.style.filter="alpha(opacity=100)";
		this.iOpacity = 1;
		goMove(this);
	};
};
function goMove(obj)
{
	obj.goObj = setInterval(function()
	{
		obj.iOpacity -= 0.01;
		obj.style.opacity=obj.iOpacity;
		obj.style.filter="alpha(opacity="+obj.iOpacity*100+")";
		if(obj.iOpacity < 0)
		{
			clearInterval(obj.goObj);
		}
	}
	,10);
}
</script>
</head>

<body>
<div id="k" style="background-color:#333333; height:300px; width:700px;"></div>
</body>
</html>

 

posted @ 2012-01-11 15:19 彭成刚 阅读(7) 评论(0) 编辑

2011年5月1日

public string GetUrltoHtml(string Url)

摘自: 提供一个网页抓取hao123手机号码归属地的例子 http://www.cnblogs.com/sufei/archive/2011/04/29/2033036.html
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Net.Security;
using System.Security.Cryptography;
using System.Xml;

namespace ccbText
{
    public partial class Form2 : Form
    {

        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Load(object sender, EventArgs e)
        {
        }
             这个方法在这里没有用到,大家可以做为参考
        /// <summary>
        /// 传入URL返回网页的html代码
        /// </summary>
        /// <param name="Url">URL</param>
        /// <returns></returns>
        public string GetUrltoHtml(string Url)
        {
            StringBuilder content = new StringBuilder();

            try
            {
                // 与指定URL创建HTTP请求
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
                request.KeepAlive = false;
                // 获取对应HTTP请求的响应
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                // 获取响应流
                Stream responseStream = response.GetResponseStream();
                // 对接响应流(以"GBK"字符集)
                StreamReader sReader = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
                // 开始读取数据
                Char[] sReaderBuffer = new Char[256];
                int count = sReader.Read(sReaderBuffer, 0, 256);
                while (count > 0)
                {
                    String tempStr = new String(sReaderBuffer, 0, count);
                    content.Append(tempStr);
                    count = sReader.Read(sReaderBuffer, 0, 256);
                }
                // 读取结束
                sReader.Close();
            }
            catch (Exception)
            {
                content = new StringBuilder("Runtime Error");
            }

            return content.ToString();

        }


        /// <summary>
        /// 好123查询,符合下列规则也可使用
        /// 返回xml
        /// 需要顺序的节点:
        /// QueryResult(查询结果状态True,False)
        /// Province(所属省份)
        /// City(所属地区)
        /// Corp(服务商)
        /// Card(卡类型 GSM)
        /// AreaCode(区号)
        /// PostCode(邮编)
        /// </summary>
        /// <param name="url"></param>
        /// <param name="mobileNum"></param>
        /// <returns></returns>
        public static string[] GetInfoByxml(string url, string mobileNum)
        {
            try
            {
                XmlDocument xml = new XmlDocument();
                // xml.LoadXml("<?xml version='1.0' encoding='utf-8' ?><QueryResponse xmlns='http://api.showji.com/Locating/'><Mobile>15890636739</Mobile><QueryResult>True</QueryResult><Province>河南</Province><City>郑州</City><AreaCode>0371</AreaCode><PostCode>450000</PostCode><Corp>中国移动</Corp><Card>GSM</Card></QueryResponse>");
                xml.Load(string.Format(url, mobileNum));
                XmlNamespaceManager xmlNm = new XmlNamespaceManager(xml.NameTable);
                xmlNm.AddNamespace("content", "http://api.showji.com/Locating/");
                XmlNodeList nodes = xml.SelectNodes("//content:QueryResult|//content:Mobile|//content:Province|//content:City|//content:Corp|//content:Card|//content:AreaCode|//content:PostCode", xmlNm);
                if (nodes.Count == 8)
                {
                    if ("True".Equals(nodes[1].InnerText))
                    {

                        return new string[] { nodes[0].InnerText, nodes[2].InnerText + nodes[3].InnerText, nodes[6].InnerText + nodes[7].InnerText, nodes[4].InnerText, nodes[5].InnerText };
                    }
                }
                return new string[] { "FALSE" };
            }
            catch
            {
                return new string[] { "FALSE" };
            }
        }

        //调用方法查询数据
        private void button1_Click(object sender, EventArgs e)
        {
            foreach (string item in GetInfoByxml(" http://vip.showji.com/locating/?m={0}", txtMobile.Text.Trim()))
            {
                richTextBox1.Text += "__" + item;
            }
        }
    }
}

posted @ 2011-05-01 12:39 彭成刚 阅读(113) 评论(0) 编辑

2010年12月11日

ListView.Demo04.多列样式.CH7

代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CH7
{
public partial class CH7_DemoForm004 : Form
{
public CH7_DemoForm004()
{
InitializeComponent();
}

private ListViewColumnSorter lvwColumnSorter = new ListViewColumnSorter();

private void CH4_DemoForm042_Load(object sender, EventArgs e)
{
ListView1.View
= View.Details;
ListView1.SmallImageList
= ImageList1;

// 将 ListView 数据行排序器指派给 ListView 控件的 ListViewItemSorter 属性。
ListView1.ListViewItemSorter = lvwColumnSorter;

// 宣告并构建 ColumnHeader 对象。
ColumnHeader header1, header2, header3;
header1
= new ColumnHeader();
header2
= new ColumnHeader();
header3
= new ColumnHeader();

// 设定数据行的行首文字、水平对齐、以及宽度。
header1.Text = "文件名称";
header1.TextAlign
= HorizontalAlignment.Left;
header1.Width
= 280;

// 设定数据行的行首文字、水平对齐、以及宽度。
header2.TextAlign = HorizontalAlignment.Left;
header2.Text
= "创建时间";
header2.Width
= 200;

// 设定数据行的行首文字、水平对齐、以及宽度。
header3.TextAlign = HorizontalAlignment.Left;
header3.Text
= "扩展名";
header3.Width
= 80;

// 将数据行行首加入 ListView 控件中。
ListView1.Columns.Add(header1);
ListView1.Columns.Add(header2);
ListView1.Columns.Add(header3);

// 填入 ListView.Items 属性。
// 将目录设定成目前目录的完整路径;也就是,启动这个处理序的目录。
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Environment.CurrentDirectory);

// 从目录中取得所有档案。
System.IO.FileInfo[] files = dirInfo.GetFiles("*.*");

// 将每一个文件名称与完整路径加至 ListView 控件中。
if (files != null)
{
foreach (System.IO.FileInfo file in files)
{
ListViewItem item
= new ListViewItem(file.Name);

item.SubItems.Add(file.CreationTime.ToString());
item.SubItems.Add(file.Extension);

// 替清单项目加上图标。
switch (file.Extension)
{
case ".cs":
item.ImageIndex
= 0;

break;
case ".resx":
item.ImageIndex
= 1;

break;
case ".dll":
item.ImageIndex
= 2;

break;
case ".exe":
item.ImageIndex
= 3;

break;
case ".txt":
item.ImageIndex
= 4;

break;
default:
item.ImageIndex
= 5;

break;
}

ListView1.Items.Add(item);
}
}
}

private void ListView1_ColumnClick(object sender, ColumnClickEventArgs e)
{
// 检查被按下的数据行是否就是刚刚被排序过的数据行。
if (e.Column == lvwColumnSorter.SortColumn)
{
// 逆转此数据行的排序顺序。
if (lvwColumnSorter.Order == SortOrder.Ascending)
{
lvwColumnSorter.Order
= SortOrder.Descending;
}
else
{
lvwColumnSorter.Order
= SortOrder.Ascending;
}
}
else
{
// 设定要排序哪一个数据行,预设采用递增排序。
lvwColumnSorter.SortColumn = e.Column;
lvwColumnSorter.Order
= SortOrder.Ascending;
}

// 以上述的排序选项设定来加以排序。
this.ListView1.Sort();
}

private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{

}
}
}

 

posted @ 2010-12-11 12:09 彭成刚 阅读(106) 评论(0) 编辑

2010年11月17日

Dreamweaver 正则表达式 使用说明表

dw 正则表达式表
    
    字符
    匹配
    示例
    
    ^
    输入或行的起始部分。
    ^T 匹配“This good earth”中的“T”,但不匹配“Uncle Tom's Cabin”中的“T”。
    
    $
    输入或行的结尾部分。
    h$ 匹配“teach”中的“h”,但是不匹配“teacher”中的“h”
    
    *
    0 个或多个前置字符。
    um* 匹配“rum”中的“um”、“yummy”中的“umm”以及“huge”中的“u”
    
    +
    1 个或多个前置字符。
    um+ 匹配“rum”中的“um”和“yummy”中的“umm”,但在“huge”中没有任何匹配项
    
    ?
    前置字符最多出现一次(即,指示前置字符是可选的)。
    st?on 匹配“Johnson”中的“son”和“Johnston”中的“ston”,但在“Appleton”和“tension”中没有任何匹配项
    
    .
    除换行符外的任何单字符。
    .an 匹配短语“bran muffins can be tasty”中的“ran”和“can”
    
    x|y
    x 或 y。
    FF0000|0000FF 匹配 bgcolor=”#FF0000” 中的“FF0000”和 font color=”#0000FF” 中的“0000FF”
    
    {n}
    恰好 n 个前置字符。
    o{2} 匹配“loom”中的“oo”和“mooooo”中的前两个“o”,但在“money”中没有任何匹配项
    
    {n,m}
    至少 n 个、至多 m 个前置字符。
    F{2,4} 匹配“#FF0000”中的“FF”和“#FFFFFF”中的前四个“F”
    
    [abc]
    用括号括起来的字符中的任何一个字符。用连字符指定某一范围的字符(例如, [a-f] 等效于 [abcdef])。
    [e-g] 匹配“bed”中的“e”、“folly”中的“f”和“guard”中的“g”
    
    [^abc]
    未在括号中括起来的任何字符。用连字符指定某一范围的字符(例如,[^a-f] 等效于[^abcdef])。
    [^aeiou] 最初匹配“orange”中“r”、“book”中的“b”和“eek!”中的“k”
    
    \b
    词边界(例如空格或回车符)。
    \bb 匹配“book”中的“b”,但在“goober”和“snob”中没有任何匹配项
    
    \B
    词边界之外的任何内容。
    \Bb 匹配“goober”中的“b”,但在“book”中没有任何匹配项
    
    \d
    任何数字字符。等效于 [0-9]。
    \d 匹配“C3PO”中的“3”和“apartment 2G”中的“2”
    
    \D
    任何非数字字符。等效于 [^0-9]。
    \D 匹配“900S”中的“S”和“Q45”中的“Q”
    
    \f
    换页符。
    
    
    \n
    换行符。
    
    
    \r
    回车符。
    
    
    \s
    任何单个空白字符,包括空格、制表符、换页符或换行符。
    \sbook 匹配“blue book”中的“book”,但在“notebook”中没有任何匹配项
    
    \S
    任何单个非空白字符。
    \Sbook 匹配“notebook”中的“book”,但在“blue book”中没有任何匹配项
    
    \t
    制表符。
    
    
    \w
    任何字母数字字符,包括下划线。等效于 [A-Za-z0-9_]。
    b\w* 匹配“the barking dog”中的“barking”以及“the big black dog”中的“big”和“black”
    
    \W
    任何非字母数字字符。等效于 [^A-Za-z0-9_]。
    \W 匹配“Jake&Mattie”中的

posted @ 2010-11-17 09:40 彭成刚 阅读(79) 评论(0) 编辑

2010年10月26日

C#操作 ini文件类【转】

摘要: 类的代码如下:[代码]调用方法:[代码]转自:http://www.cnblogs.com/mccj/archive/2010/08/31/1813894.html阅读全文

posted @ 2010-10-26 22:28 彭成刚 阅读(75) 评论(0) 编辑

2010年10月25日

在代码里直接写label控件,winform C# 可以for循环,方便实用的小代码总结

摘要: this.Controls["label1"].Text = "abc"; 研究了半天的反射,发现Controls就能直接控制winform里的控件了。汗颜了。。接着研究如何在类库里面调用winform里的label了,有知道的童鞋帮忙留言啦。不知道的,请继续飘过。。public static void setLabel(vsTest01.Form1 f) { f.Controls["label1...阅读全文

posted @ 2010-10-25 20:11 彭成刚 阅读(141) 评论(0) 编辑

2010年7月16日

捕捉浏览器的刷新与关闭 兼容ie、ff(火狐)

摘要: <script language="javascript">var MSG_UNLOAD="您的文章内容还没有进行保存!";var UnloadConfirm = {};启用监听浏览器刷新、关闭的方法UnloadConfirm.set = function(confirm_msg){ window.onbeforeunload = function(event){ event = ...阅读全文

posted @ 2010-07-16 23:35 彭成刚 阅读(212) 评论(0) 编辑

2010年7月8日

利用 Repeater 获取 其中的Html,进行编程~~

摘要: 刚开始用 Panel 试了试 发现会自动加个div 很讨厌。。最后用的 Repeater 做的,主要原理就是 页面放个 Repeater,然后手工建立一个table表,建立一条记录,然后让Repeater绑定这个数据,然后渲染这个Html,得到他,然后牛能对他进行编程了,然后把这个Repeater进行隐藏。。下面把代码放上来,代码不高深,关键在思路~~ 之前一直是loadHtml做的,昨天忽然想,...阅读全文

posted @ 2010-07-08 11:38 彭成刚 阅读(156) 评论(0) 编辑

2010年6月30日

一个程序员从做网站到卖网站再回到做网站的心路历程

摘要: 前期的一堆唾沫星子:有小半年没写博了吧。。发生了很多事情~~忙忙赫赫。。在上一家公司浑浑噩噩呆了两年,又跳槽到现在的公司。不透露公司名称了,不是本文重点。重点是结婚了,昨天是一周月纪念日。生活所迫,抬头就得挣钱。像我这没啥本事的,搞搞网络,先墨迹着。为什么要写这篇废话:这就是心态不好。憋得慌,出来说说一口怨气。做个东西,从代码角度,DotNet没啥好保护机制。从网络环境角度,到处都在Copy。从能...阅读全文

posted @ 2010-06-30 17:23 彭成刚 阅读(341) 评论(2) 编辑

2010年6月29日

彭成刚 博客园 技术索引贴 置顶!

摘要: 把常用的都放首页上来。。就不用每次都要翻页找半天了~~ppRoll4.js 最新滚动插件 用json结构做的http://www.cnblogs.com/pengpengsay/archive/2010/04/21/1717440.html新做的焦点图js组件 focus1.js 用json传参http://www.cnblogs.com/pengpengsay/archive/2010/04/2...阅读全文

posted @ 2010-06-29 14:39 彭成刚 阅读(99) 评论(0) 编辑