代码片段,留下网络生活!
DbHelperSQL.cs
[
2008/11/18 14:22 | by Else ]
2008/11/18 14:22 | by Else ]
把李天平老师的代码拿过来学习
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.Common;
using System.Collections.Generic;
namespace Maticsoft.DBUtility
{
///
/// 数据访问抽象基础类
/// Copyright (C) 2004-2008 By LiTianPing
///
public abstract class DbHelperSQL
{
//数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库.
public static string connectionString = PubConstant.ConnectionString;
public DbHelperSQL()
{
}
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Data.Common;
using System.Collections.Generic;
namespace Maticsoft.DBUtility
{
///
/// 数据访问抽象基础类
/// Copyright (C) 2004-2008 By LiTianPing
///
public abstract class DbHelperSQL
{
//数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库.
public static string connectionString = PubConstant.ConnectionString;
public DbHelperSQL()
{
}
jquery的表格操作,一般用於投票調查
[
2008/11/17 10:46 | by Else ]
2008/11/17 10:46 | by Else ]
onclick="$('#sendctrl').before($(this).parents('tr').next().clone())"
onclick="$(this).parents('tr').remove()"
onclick="$(this).parents('tr').remove()"
<table width="200" border="0" cellspacing="1" cellpadding="3" id="upvote">
<tr>
<th colspan="2">添加調查
<div id="msg" style="color:red;"></div>
</th>
</tr>
<tr id="itemap">
<td width="41px">其它</td>
<td width="706px">
排序
<input name="txtnum" type="text" value="10" id="txtnum" style="width:20px;" />
類型
<input name="txttype" type="text" value="1" id="txttype" style="width:20px;" />
</td>
</tr>
<tr>
<td width="41px">主 題</td>
<td width="706px"><input name="txttitle" type="text" value="" id="txttitle" style="width:300px;" />
<a href="javascript:void(0);" onclick="$('#sendctrl').before($(this).parents('tr').next().clone())">增加選項</a>
</td>
</tr>
<tr>
<td>選 項</td>
<td><label>
編號:<input readonly="readonly" type="text" style="width:15px" name="id1" value="" />
<input width="100px" type="text" name="answer1" value=""/>
其它
<input width="50px" type="text" name="other1" value=""/>
</label> <a href="javascript:void(0);" onclick="$(this).parents('tr').remove()">删除</a></td>
</tr>
<tr id="sendctrl">
<td> </td>
<td><label>
<input type="button" onclick="javascript:itemsave();" value="添加" />
<input type="reset" name="button2" id="button2" value="重設" />
</label></td>
</tr>
</table>
<tr>
<th colspan="2">添加調查
<div id="msg" style="color:red;"></div>
</th>
</tr>
<tr id="itemap">
<td width="41px">其它</td>
<td width="706px">
排序
<input name="txtnum" type="text" value="10" id="txtnum" style="width:20px;" />
類型
<input name="txttype" type="text" value="1" id="txttype" style="width:20px;" />
</td>
</tr>
<tr>
<td width="41px">主 題</td>
<td width="706px"><input name="txttitle" type="text" value="" id="txttitle" style="width:300px;" />
<a href="javascript:void(0);" onclick="$('#sendctrl').before($(this).parents('tr').next().clone())">增加選項</a>
</td>
</tr>
<tr>
<td>選 項</td>
<td><label>
編號:<input readonly="readonly" type="text" style="width:15px" name="id1" value="" />
<input width="100px" type="text" name="answer1" value=""/>
其它
<input width="50px" type="text" name="other1" value=""/>
</label> <a href="javascript:void(0);" onclick="$(this).parents('tr').remove()">删除</a></td>
</tr>
<tr id="sendctrl">
<td> </td>
<td><label>
<input type="button" onclick="javascript:itemsave();" value="添加" />
<input type="reset" name="button2" id="button2" value="重設" />
</label></td>
</tr>
</table>
js改变网页字体的大小
[
2008/10/27 11:29 | by Else ]
2008/10/27 11:29 | by Else ]
代码:
复制代码 | 运行代码 | 另存代码
<!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=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//Font size control
function doZoom(size) {
document.getElementById('zoomtext').style.fontSize=size+'px';
}
</script>
</head>
<body>
<div>设置字体大小:<a href="javascript:doZoom(16);">大</a> <a href="javascript:doZoom(14);">中</a> <a href="javascript:doZoom(12);">小</a></div>
<div id="zoomtext">这个是要显示的字体大小</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//Font size control
function doZoom(size) {
document.getElementById('zoomtext').style.fontSize=size+'px';
}
</script>
</head>
<body>
<div>设置字体大小:<a href="javascript:doZoom(16);">大</a> <a href="javascript:doZoom(14);">中</a> <a href="javascript:doZoom(12);">小</a></div>
<div id="zoomtext">这个是要显示的字体大小</div>
</body>
</html>
显示mssql表结构的sql
[
2008/10/22 21:29 | by Else ]
2008/10/22 21:29 | by Else ]
其中weborder是表
SELECT
INFORMATION_SCHEMA.COLUMNS.*,
COL_LENGTH('weborder', INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME) AS COLUMN_LENGTH,
COLUMNPROPERTY(OBJECT_ID('weborder'), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsComputed') AS IsComputed,
COLUMNPROPERTY(OBJECT_ID('weborder'), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsIdentity') AS IsIdentity,
COLUMNPROPERTY(OBJECT_ID('weborder'), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsRowGuidCol') AS IsRowGuidCol,
ExtendedProperties.Value AS ProgrammaticAlias
FROM
INFORMATION_SCHEMA.COLUMNS
LEFT JOIN ::fn_listextendedproperty('ProgrammaticAlias', 'user', 'dbo', 'table', 'weborder', 'column', default) AS ExtendedProperties
ON INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME = ExtendedProperties.objName COLLATE Chinese_PRC_CI_AS
WHERE
INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'weborder'
INFORMATION_SCHEMA.COLUMNS.*,
COL_LENGTH('weborder', INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME) AS COLUMN_LENGTH,
COLUMNPROPERTY(OBJECT_ID('weborder'), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsComputed') AS IsComputed,
COLUMNPROPERTY(OBJECT_ID('weborder'), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsIdentity') AS IsIdentity,
COLUMNPROPERTY(OBJECT_ID('weborder'), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsRowGuidCol') AS IsRowGuidCol,
ExtendedProperties.Value AS ProgrammaticAlias
FROM
INFORMATION_SCHEMA.COLUMNS
LEFT JOIN ::fn_listextendedproperty('ProgrammaticAlias', 'user', 'dbo', 'table', 'weborder', 'column', default) AS ExtendedProperties
ON INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME = ExtendedProperties.objName COLLATE Chinese_PRC_CI_AS
WHERE
INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'weborder'
仿口碑网菜单效果 优化了js
[
2008/10/21 12:48 | by Else ]
2008/10/21 12:48 | by Else ]
function showmore(getid)
{
var dshow=document.getElementById(getid);
var showid=dshow.getElementsByTagName("dl");
if(showid.length<1) return false;
for(var i=0;i //初始化,让第一个类为over
if(showid[i].className.indexOf("over")==-1){
showid[0].className="over";
}
//遍历循环,模拟:hover伪类
showid[i].onmouseover=function(){
for(var j=0;j showid[j].className="";
}
this.className="over";
}
}
}
window.onload=function(){
showmore("wrapper");
showmore("wrapper1");
showmore("wrapper2");
showmore("wrapper3");
}
{
var dshow=document.getElementById(getid);
var showid=dshow.getElementsByTagName("dl");
if(showid.length<1) return false;
for(var i=0;i
if(showid[i].className.indexOf("over")==-1){
showid[0].className="over";
}
//遍历循环,模拟:hover伪类
showid[i].onmouseover=function(){
for(var j=0;j
}
this.className="over";
}
}
}
window.onload=function(){
showmore("wrapper");
showmore("wrapper1");
showmore("wrapper2");
showmore("wrapper3");
}
仿口碑网菜单效果 [多个]
[
2008/10/21 11:22 | by Else ]
2008/10/21 11:22 | by Else ]
window.onload=function(){
var w1=document.getElementById("wrapper");
var w2=document.getElementById("wrapper1");
var w3=document.getElementById("wrapper2");
var w4=document.getElementById("wrapper3");
var dl_1=w1.getElementsByTagName("dl");
//alert(dl_1.length);
if(dl_1.length<1) return false;
for(var i=0;i<dl_1.length;i++){
//初始化,让第一个类为over
if(dl_1[i].className.indexOf("over")==-1){
dl_1[0].className="over";
}
//遍历循环,模拟:hover伪类
dl_1[i].onmouseover=function(){
for(var j=0;j<dl_1.length;j++){
dl_1[j].className="";
}
this.className="over";
}
}
html的tag你用了几个?
[
2008/10/20 15:25 | by Else ]
2008/10/20 15:25 | by Else ]
HTML Tags
<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
ie下的3px bug两种方法
[
2008/09/30 22:18 | by Else ]
2008/09/30 22:18 | by Else ]
这个是官方推荐的方法,通过dw的验证
这里的代码
ie下会多3px;
加head上面加这个,加zoom
ps.........................................................
昨天的排版,今天挖错,我的排版中是用4px和8px,在fw下对比,左右两边正常!无逢链接!
这里的代码
ie下会多3px;
.cls6_1,.cls5_1{margin-left:8px;}
加head上面加这个,加zoom
<!--[if IE]>
<style type="text/css">
.cls6_1,.cls5_1{margin-left:5px;zoom:1;}
.cls5_2{margin-left:298px;margin-right:254px;zomm:1;}
.cls6_2,.cls5_3{margin-right:5px;zoom:1;}
</style>
<![endif]-->
<style type="text/css">
.cls6_1,.cls5_1{margin-left:5px;zoom:1;}
.cls5_2{margin-left:298px;margin-right:254px;zomm:1;}
.cls6_2,.cls5_3{margin-right:5px;zoom:1;}
</style>
<![endif]-->
ps.........................................................
昨天的排版,今天挖错,我的排版中是用4px和8px,在fw下对比,左右两边正常!无逢链接!
Three-pixel text jog
[
2008/09/26 08:08 | by Else ]
2008/09/26 08:08 | by Else ]
This issue was originally documented by Holly Bergevin and Big John Gallant on positioniseverything.net.
http://www.positioniseverything.net/explorer/threepxtest.html
Fixing this 3-pixel text jog that's introduced when line boxes with inline elements are adjacent to a float in IE/Windows requires giving the paragraph an explicit dimension, which prevents IE/win from adding the 3px space. However, adding a dimension (width or height) also throws IE into a proprietary float model- and the element will act much like a float, displaying next to the real floated element, as opposed to letting the float overlap it.
The old (pre-IE7) solution for this bug, and several others, was the Holly Hack. However, the Holly Hack relies on buggy behavior that is no longer present in Internet Explorer 7 -- and using it can cause things to go a bit haywire. Instead, use an Internet Explorer Conditional Comment (IECC) to apply zoom: 1 to the line box in all versions of Internet Explorer. This will give the box the "layout" it needs to prevent the three-pixel gap, without throwing Internet Explorer into its proprietary float model.
http://www.positioniseverything.net/explorer/threepxtest.html
Fixing this 3-pixel text jog that's introduced when line boxes with inline elements are adjacent to a float in IE/Windows requires giving the paragraph an explicit dimension, which prevents IE/win from adding the 3px space. However, adding a dimension (width or height) also throws IE into a proprietary float model- and the element will act much like a float, displaying next to the real floated element, as opposed to letting the float overlap it.
The old (pre-IE7) solution for this bug, and several others, was the Holly Hack. However, the Holly Hack relies on buggy behavior that is no longer present in Internet Explorer 7 -- and using it can cause things to go a bit haywire. Instead, use an Internet Explorer Conditional Comment (IECC) to apply zoom: 1 to the line box in all versions of Internet Explorer. This will give the box the "layout" it needs to prevent the three-pixel gap, without throwing Internet Explorer into its proprietary float model.
<!--[if IE]><style type="text/css"> .mybuggyelement { zoom: 1;}</style><![endif]-->
修改原来的类,达到可以执行存储过程
[
2008/09/18 16:00 | by Else ]
2008/09/18 16:00 | by Else ]
//连接数据库
//link database
function DBLink($dbhost='localhost', $dbuser='root', $password='', $dbname='', $pconnect=0){
$this->LinkID[$this->Line] = ($pconnect == 1)? @mysql_pconnect($dbhost, $dbuser, $password,0,131072) : @mysql_connect($dbhost, $dbuser, $password,0,131072) or die("Connect to MySQL ($dbhost,$dbuser) failed");
//选择连接数据库
//choose to link database
@mysql_select_db($dbname, $this->LinkID[$this->Line]) or die('Cannot use database '.$dbname);
return $this->LinkID[$this->Line];
}
//link database
function DBLink($dbhost='localhost', $dbuser='root', $password='', $dbname='', $pconnect=0){
$this->LinkID[$this->Line] = ($pconnect == 1)? @mysql_pconnect($dbhost, $dbuser, $password,0,131072) : @mysql_connect($dbhost, $dbuser, $password,0,131072) or die("Connect to MySQL ($dbhost,$dbuser) failed");
//选择连接数据库
//choose to link database
@mysql_select_db($dbname, $this->LinkID[$this->Line]) or die('Cannot use database '.$dbname);
return $this->LinkID[$this->Line];
}
这个是执行的效果,还不错,性能还没有测试!放弃php4 和mysql4
$aaa=$ck->et_list("call news()");
print_r($aaa);
print_r($aaa);














