View Mode: Normal | Article List

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...

Javascript判断空格

[ 2004-09-09 00:41:16 | Author: zhenhua ]
正则
<script>
 function checkvalue(){
 if(document.Form.content.value.replace(/\s/g,"")=="")

 {
 alert("内容不能为空!");
 document.addForm.content.focus();
 return false;
 }
 document.addForm.submit();
 return true;
}
</script>
 

匹配中文字符的正则表达式: [\u4e00-\u9fa5]

匹配双字节字符(包括汉字在内): [^\x00-\xff]

应用:计算字符串的长度(一个双字节字符长度计2,ASCII字符计1)

String.prototype.len=function(){return this.replace([^\x00-\xff]/g,"aa").length;}

匹配空行的正则表达式: \n[\s| ]*\r

匹配HTML标记的正则表达式: /<(.*)>.*<\/>|<(.*) \/>/
...

Read More...

asp图片目录直读

[ 2004-09-09 00:40:39 | Author: zhenhua ]
<%@language=vbscript codepage=936 %>
<%
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'++++++Wrance的图片系统目录直读版1.0+++++++++++++++++++++++
'++++++演示:http://www.cnecg.com/pic.asp++++++++++++++++++
'++++++此为免费程序,您可以任意修改,欢迎发表建议++++++++++
'++++++Email:cnecg@yahoo.com.cn,QQ:74028+++++++++++++++++++

'以下为修改内容
Const UploadDir="/uptupian" '存放文件的目录
Const MaxPerPage=30 '每页显示数量
const title="+++__Wrance的图片系统目录直读版_ " '标题

'检查组件是否已经安装
Function IsObjInstalled(strClassString)
...

Read More...