身份证的验证
function isIdCardNo(num)
{
if (isNaN(num)) {alert("输入的不是数字!"); return false;}
var len = num.length, re;
if (len == 15)
re = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/);
else if (len == 18)
re = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d)$/);
else {alert("输入的数字位数不对!"); return false;}
var a = num.match(re);
if (a != null)
{
if (len==15)
{
var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]);
var B = D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
}
else
{
var D = new Date(a[3]+"/"+a[4]+"/"+a[5]);
var B = D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
}
if (!B) {alert("输入的身份证号 "+ a[0] +" 里出生日期不对!"); return false;}
}
return true;
}
画图类,含饼、柱、矢量贝滋曲线
<OBJECT
id=S
style="LEFT: 0px; WIDTH: 392px; TOP: 0px; HEIGHT: 240px"
height=240
width=392
classid="clsid:369303C2-D7AC-11D0-89D5-00A0C90833E6">
</OBJECT>
<SCRIPT>
S.DrawingSurface.ArcDegrees(0,0,0,30,50,60);
S.DrawingSurface.ArcRadians(30,0,0,30,50,60);
S.DrawingSurface.Line(10,10,100,100);
</SCRIPT>
双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize()
{
timer=setInterval ("scrollwindow ()",30);
}
function sc()
{
clearInterval(timer);
}
function scrollwindow()
{
currentpos=document.body.scrollTop;
window.scroll(0,++currentpos);
if (currentpos !=document.body.scrollTop)
sc();
}
document.onmousedown=sc
document.ondblclick=initialize
调整window的滚动条大小
<body style="zoom:2">
<div style="zoom:0.5" >
</div>
</body>
实现启动时加载类
第一步web.xml里添加
<listener>
<listener-class>schoolcard.util.TimerListener</listener-class>
</listener>
第2步创建监听类
package schoolcard.util;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class TimerListener implements ServletContextListener {
private ServletContext context = null;
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
System.out.println("服务器开始启动.......................");
//TimerUtil.runTimer();
}
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
}
}
java里面定时器的制作
package schoolcard.util;
import java.util.Timer;
import schoolcard.dao.DAOFactory;
import schoolcard.datasource.PersistenceConstants;
public class TimerUtil {
/**
* @param args
*/
public static void runTimer() {
PersistenceConstants psc=new PersistenceConstants();
String waitTime=psc.getProperty("repeatTime");
int wt=Integer.parseInt(waitTime);
System.out.println("wt"+waitTime);
// TODO Auto-generated method stub
try{
Timer timer= new Timer();
timer.schedule(
new java.util.TimerTask() {
public void run()
{
//调用检测发送进程
System.out.println("XXXXXXXXXXXX**********************XXXXXXXXXXXX");
DAOFactory df = DAOFactory.getDAOFactory();
}
}, 0, wt*1000);
}catch(Exception e)
{
System.err.println("定时器出现问题");
e.printStackTrace();
}
}
public static void main(String[] args)
{
TimerUtil.runTimer();
}
}
posted on 2006-10-22 10:20
acerbic coffee 阅读(245)
评论(0) 编辑 收藏 所属分类:
个人记录