日历
| |||||||||
| 日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
| 1 | 2 | 3 | 4 | ||||||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 | |||
| 12 | 13 | 14 | 15 | 16 | 17 | 18 | |||
| 19 | 20 | 21 | 22 | 23 | 24 | 25 | |||
| 26 | 27 | 28 | 29 | 30 | 31 | ||||
搜索标题
最新来客
最新评论
统计信息
- 访问量: 2882
- 日志数: 17
- 图片数: 4
- 建立时间: 2007-05-23
- 更新时间: 2007-07-24
我的最新日志
-
javascript实现用checkbox锁定text输入框
2007-7-24
<html>
<head>
<title></title>
<scrīpt LANGUAGE="Javascrīpt">
<!--
function tune(){
if (document.form1.all.checked==true)
{
document.form1.name.disabled=true;
} else {
document.form1.name.disabled=false;
}
}
-->
</scrīpt>
</head><body>
<form name="form1" method="post" action="">
<table width="100%" height="97" border="0" cellpadding="0" cellspacing="0">
<tr>
<th width="25%" align="right">接收者ID<br>(多用户用","分割)</th>
<td width="75%"><input type="text" name="name" size="35" value=""></td>
</tr>
<tr>
<th align="right">发送给所有户<br></th>
<td><input type="checkbox" name="all" value="all" ōnclick=tune()></td>
</tr>
<tr>
<th align="right">消息内容</td>
<td><textarea name="textarea" cols="40" rows="10"></textarea></td>
</tr>
<tr>
<th> </td>
<td><input type="submit" name="Submit" value="提交">
<input type="reset" name="reset" value="重填"></td>
</tr>
</table></form>
</body>
</html> -
可以用linux命令行操作的 遍历目录 查找文件的代码
2007-7-11
#!/usr/bin/php -q
<?php
/*
wangliang 2007-7-9检查目录里图片的大小,不符合要求的写入./MistakePhoto.txt文件
*/printf("Please provide your inquiries to the dir : "); //获得命令行下输入的目录路径
$dir = read_input(); //获得路径
printf("Please enter the size inquiries Photo (KB):"); //获得查询图片的大小
$filesize = read_input(); //获得判断图片的大小if (is_dir($dir)) { //判断是否是目录
open_dir($dir);
}else{
echo "Directory does not exist!";
}exit;
?>
<?
function read_input(){
$fp = fopen("/dev/stdin", "r");
$input = trim(fgets($fp, 1024));
fclose($fp);
return $input;
}
function open_dir($dir){
if (!is_dir($dir)){ //如果不是目录,return
return;
}
if ($dh = opendir($dir)) { //打开目录
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != "..") { //去掉. and .. 目录
if(substr($file,-4)==".jpg" || substr($file,-4)==".JPG"){//判断图像类型是否为jpg
$filename=$dir."/".$file; //获得图片路径
open_file($filename);
}else{
$redir=$dir."/".$file; //重新定义一个dir为原dir+非jpg的文件名
open_dir($redir); //再次对目录进行递归,找出大于30k的图片
}
}
}
closedir($dh); //关闭目录
}
return;
}function open_file($filename){
$filesize=$GLOBALS['filesize'];
$namesize=filesize($filename);
if($namesize > $filesize*1024){//判断图片大小
$fp=fopen("./MistakePhoto.csv","a+");
fwrite($fp,$filename.",".$namesize."\n"); //在打开的文件里写入
fclose($fp);
print_r ($filename.",".$namesize."\n"); //输出内容
}
return;
}
?> -
php中header用法的范例
2007-7-03
范例一: 本例使浏览器重定向到 PHP 的官方网站。
<?php
header("Location: http://www.php.net";);
exit;
?>
范例二: 加个判断<?php
if(xxx)
{
Header("Location: http://www.php.net");
}else{
Header("Location: http://www.php2.net");
}
?>
范例三: 定时转跳<?php
header("refresh:3;url=http://axgle.za.net");
print('正在加载,请稍等...<br>三秒后自动跳转~~~');
/*
补充说明:
若等待时间为0,则与header("location:")等效。
*/
?> -
工作中接触过的PHP函数
2007-7-03
在公司 接触更多的函数 留个备份 方便日后学习
不断更新中...
GetImageSize --取得图像大小
ImageCreateFromGIF --从 GIF 文件或 URL 新建一图像
imagecreatefromjpeg --从 JPEG 文件或 URL 新建一图像
ImageCreateFromPNG --从 PNG 文件或 URL 新建一图像
ImageSX --取得图像宽度
ImageSY --取得图像高度
ImageCreate --新建一个基于调色板的图像
ImageCopyResized --拷贝部分图像并调整大小
ImageJpeg --以 JPEG 格式将图像输出到浏览器或文件trim --去除空白字符
header --页面转跳
date --格式化一个本地时间/日期
time --返回当前的 Unix 时间戳
count --计算数组中的单元数目或对象中的属性个数
array_push --将一个或多个单元压入数组的末尾(入栈)
explode --使用一个字符串分割另一个字符串
getDate --取得日期/时间信息
is_numeric --检测变量是否为数字或数字字符串
ceil --进一法取整
file --把整个文件读入一个数组中
fopen --打开文件或者 URL
feof --测试文件指针是否到了文件结束的位置
filesize --取得文件大小
fread --读取文件(可安全用于二进制文件)
fwrite --写入文件(可安全用于二进制文件)
fclose --关闭一个已打开的文件指针
str_replace --匹配和替换字符串
substr --对字符串进行截取
copy --拷贝文件
AddSlashes --使用反斜线引用字符串
strlen --获取一个字符串的编码长度
StripSlashes --反转义addslashes()函数转义处理过的字符串
htmlspecialchars --将字符串中一些字符转换为HTML实体
preg_match --进行正则表达式匹配
Mail --发送邮件
system --执行一个外部程序并显示输出
chr --返回指定的字符
number_format --按照参数对数字进行格式化的输出
unlink --删除文件
array_merge --合并一个或多个数组mb_substr -- 是按字来切分字符
mb_strcut -- 是按字节来切分字符 -
鼠标经过显示不同图片
2007-6-29
鼠标经过显示不同图片:
<scrīpt LANGUAGE="Javascrīpt">
var a = new Image();
var b = new Image();
var c = new Image();
a.src = "../../../yanyanyan/me/me/4.jpg";
b.src = "../../../yanyanyan/me/me/3.jpg";
c.src = "../../../yanyanyan/me/me/2.jpg";
function doButtons(picimage) {
eval("document['picture'].src = " + picimage + ".src");
}
</scrīpt>
</head>
<body>
<table width="407" height="201" border=0 cellpadding="0" cellspacing="0" bgcolor="#333333">
<tr><td width="110" align="center">
<p>
<a href="#" ōnmouseover="doButtons('a')">PHOTO 1</a><p>
<a href="#" ōnmouseover="doButtons('b')">PHOTO 2</a><p>
<a href="#" ōnmouseover="doButtons('c')">PHOTO 3</a><p>
<td width="297"><img name=picture src="../../../yanyanyan/me/me/4.jpg" width=294 height=345 border=0></td>
</tr>
</table>更多特效:
-
asp 随机图片显示 百变美女asp代码
2007-6-29
asp 随机图片显示 百变美女asp代码:
来自落伍者论坛,作者野汉子
<%@LANGUAGE="VBscrīpt" CODEPAGE="936"%>
<%
'----------------------------------------------------------------------------------------
'转发时请保留此声明信息,这段声明不并会影响你的显示速度!
'************************* 随机图片显示 ****************************
'代码设计:野汉子
'使用实例:img.asp?list=图片存放目录
'网站:http://yjj.con.cn
'声明:版权没有,随意使用!^_^不过如果各位不介意给我做个小小的连接,在下将感激不尽!
'----------------------------------------------------------------------------------------
Function AllPath()
Dim Domain,GFilePath
Domain = Request.ServerVariables("SERVER_NAME")
GFilePath = Request.ServerVariables("PATH_INFO")
GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/")))
AllPath = "http://"&Domain&GFilePath
End Function
Function ShowFileList(folderspec)
Dim Path,objFSO,objFolder,count,objFile,nume,S
Path = Server.MapPath(folderspec)
Set ōbjFSO = Server.CreateObject("scrīpting.FileSystemObject")
If objFSO.FolderExists(Path) Then
Set ōbjFolder = objFSO.GetFolder(Path)
count = 0
For Each objFile in objFolder.Files
count = count+1
Next
randomize
nume = Int((count*rnd)+1)
S = 0
ShowFileList = ""
For Each objFile in objFolder.Files
S = S + 1
If S = nume Then
ShowFileList = objFile.Name
Exit For
End If
Next
Set ōbjFolder = Nothing
Else
ShowFileList = "NO"
End If
Set ōbjFSO = Nothing
End Function
Dim list,filename,address,str
list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=图片存放目录"
Response.End()
end if
filename = ShowFileList("./"&list&"/")
if filename = "NO" then
Response.write "您指定的目录<b>"&list&"</b>不存在,请重新指定!"
Response.End()
end if
if filename = "" then
Response.write "您指定的目录<b>"&list&"</b>没有相关的图片文件存在,请重新指定!"
Response.End()
end if
str = right(filename,3)
if str<>"jpg" and str<>"gif" then
filename = "erro.gif"
end if
address = AllPath&list&"/"
address = address&filename
%>
<%Response.redirect(address)%> -
页面自动刷新,页面自动跳转
2007-6-29
1.页面自动刷新:把如下代码加入<head>区域中:
<meta http-equiv="refresh" content="20">
2.页面自动跳转:把如下代码加入<head>区域中:
<meta http-equiv="refresh" content="20;url=http://www.163.com">
-
同页面的超级链接不同颜色
2007-6-29
同页面的超级链接不同颜色:
<html>
<head>
<style>
a.a1:link {
font-size: 9pt;
color: #000000;
text-decoration: none;
}
a.a1:visited {
font-size: 9pt;
color: #999999;
text-decoration: none;
}
a.a1:hover {
font-size: 9pt;
color: #FF6600;
position: relative;
top: 1px;
}
a.a1:active {
font-size: 9pt;
color: #333333;
text-decoration: none;
}
a.a2:link {
font-size: 9pt;
color: #00ff00;
}
a.a2:hover {
font-size: 10pt;
color: #FF3300;
position: relative;
top: 5px;
}
a.a2:active {
font-size: 9pt;
color: #fffff;
text-decoration: none;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<center>
<br>
<br>
<br>
<br>
<a href="" class="a1">123456</a>
<a href="" class="a2">000000</a>
</center>
</body>
</html> -
状态栏 +在body中就ok
2007-6-29
状态栏 +在body中就ok:
<scrīpt language="Javascrīpt">
var MESSAGE = " 欢迎 "
var POSITION = 150
var DELAY = 10
var scroll = new statusMessageObject()
function statusMessageObject(p,d) {
this.msg = MESSAGE
this.out = " "
this.pos = POSITION
this.delay = DELAY
this.i = 0
this.reset = clearMessage}
function clearMessage() {
this.pos = POSITION}
function scroller() {
for (scroll.i = 0; scroll.i < scroll.pos; scroll.i++) {
scroll.out += " "}
if (scroll.pos >= 0)
scroll.out += scroll.msg
else scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length)
window.status = scroll.out
scroll.out = " "
scroll.pos--
if (scroll.pos < -(scroll.msg.length)) {
scroll.reset()}
setTimeout ('scroller()',scroll.delay)}
function snapIn(jumpSpaces,position) {
var msg = scroll.msg
var ōut = ""
for (var i=0; i<position; i++)
{out += msg.charAt(i)}
for (i=1;i<jumpSpaces;i++)
{out += " "}
out += msg.charAt(position)
window.status = out
if (jumpSpaces <= 1) {
position++
if (msg.charAt(position) == ' ')
{position++ }
jumpSpaces = 100-position
} else if (jumpSpaces > 3)
{jumpSpaces *= .75}
else
{jumpSpaces--}
if (position != msg.length) {
var cmd = "snapIn(" + jumpSpaces + "," + position + ")";
scrollID = window.setTimeout(cmd,scroll.delay);
} else { window.status=""
jumpSpaces=0
position=0
cmd = "snapIn(" + jumpSpaces + "," + position + ")";
scrollID = window.setTimeout(cmd,scroll.delay);
return false }
return true}
snapIn(100,0);
</scrīpt> -
JS代码容错,flash透明
2007-6-29
JS代码容错:
<scrīpt LANGUAGE="Javascrīpt">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</scrīpt>flash透明:
<PARAM NAME="wmode" VALUE="transparent">
