View Mode: Normal | Article List

JavaScript 处理图片类

[ 2004-09-09 01:00:40 | Author: zhenhua ]
<title>文件上传前台控制检测程序 v0.6</title>
<style>
body,td{font-size:12px;}
</style>
<script language=javascript>

/*----------------------------------------
 文件上传前台控制检测程序 v0.6

 远程图片检测功能
 检测上传文件类型

 检测图片文件格式是否正确
 检测图片文件大小
 检测图片文件宽度
 检测图片文件高度
 图片预览

 For 51js.com Author:333 Date:2005/08/26
 UpDate:2005/09/03
-----------------------------------------*/

var ImgObj=new Image(); //建立一个图像对象

var AllImgExt=".jpg|.jpeg|.gif|.bmp|.png|"//全部图片格式类型
var FileObj,ImgFileSize
...

Read More...

CSS小技巧

[ 2004-09-09 00:45:21 | Author: zhenhua ]
<style>
.db tr{
background-color:expression('#eeeeee,#eeeeee,#eeeeee,#cccccc,#cccccc,#cccccc'.split(',')[rowIndex%6]);
}
</style>
<table width="500" border="1" class="db">
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>

JSP/JavaScript 自动加行

[ 2004-09-09 00:44:24 | Author: zhenhua ]
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>

<script language=javascript1.2>

/*
*============================================================
*/

//定义全局的表格行列值
var col = 5;
var row = 2;

//currRowIndex 选定行
var currRowIndex = 0;
...

Read More...

JavaScript 图片滚动

[ 2004-09-09 00:43:57 | Author: zhenhua ]
<div id="demo" style="overflow: hidden; width: 300px; height: 120px; background-color:#00cc66;">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
 <tr>
 <td id="demo1" nowrap="nowrap">
 <img src="http://image2.sina.com.cn/home/images/sina_logo2.gif" />
 <img src="http://image2.sina.com.cn/home/images/sina_logo2.gif" />
 <img src="http://image2.sina.com.cn/home/images/sina_logo2.gif" />
 <img src="http://image2.sina.com.cn/home/images/sina_logo2.gif" />
...

Read More...

JavaScript MD5算法

[ 2004-09-09 00:43:27 | Author: zhenhua ]
<script language="JavaScript">
/*****************************************************************************
* md5.js
*
* A JavaScript implementation of the RSA Data Security, Inc. MD5
* Message-Digest Algorithm.
*
* Copyright (C) Paul Johnston 1999. Distributed under the LGPL.
*****************************************************************************/

/* to convert strings to a list of ascii values */
var sAscii = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
...

Read More...

JavaScript Unicode编码和反编码

[ 2004-09-09 00:42:58 | Author: zhenhua ]
<script>
function unicode(s){
 var len=s.length;
 var rs="";
 for(var i=0;i<len;i++){
 var k=s.substring(i,i+1);
 rs+="&#"+s.charCodeAt(i)+";";
 }
 return rs;
}

function runicode(s){
 var k=s.split(";");
 var rs="";
 for(i=0;i<k.length;i++){
 var m=k.replace(/&#/,"");
 rs+=String.fromCharCode(m);
 }
 return rs;
}
alert(unicode("我是一个神"));//我是一个神
alert(runicode("我是一个神"));
</script>

JavaScript提醒/自动提交

[ 2004-09-09 00:42:28 | Author: zhenhua ]
<SCRIPT LANGUAGE="JavaScript">
<!--
var time="3600";
var atime="300";
var etime="0";
function count(){
 setTimeout("count()",1000);
 document.form1.rest.value=format(Math.floor(time/60))+"分:"+format(time%60)+"秒";
 time--;
 if(time==atime){
 alert("还剩5分钟");
 }
 if(time==etime-1){
 alert("时间到,已经自动提交");
 document.form1.submit();
 }
}

function format(time){
 var len=time.toString().length;
 for(i="0";i<2-len;i++){
 time+="0";
...

Read More...

JavaScript 计算器

[ 2004-09-09 00:42:09 | Author: zhenhua ]
<form name="form2" onClick="count(this)">
<INPUT TYPE="button" value="0" name="a">
<INPUT TYPE="button" value="1" name="a">
<INPUT TYPE="button" value="2" name="a">
<INPUT TYPE="button" value="3" name="a">
<INPUT TYPE="button" value="4" name="a">
<INPUT TYPE="button" value="5" name="a">
<INPUT TYPE="button" value="6" name="a">
<INPUT TYPE="button" value="7" name="a">
<INPUT TYPE="button" value="8" name="a">
<INPUT TYPE="button" value="9" name="a">
<INPUT TYPE="button" value="-" name="a">
...

Read More...