日期:2014-05-16 浏览次数:20461 次
/* 获取上一页url */
document.referrer
/* 获取当前页 */
alert("当前页 : " + window.location.href);
/* 设为首页 */
function setMyHome() {
if (document.all) {
document.body.style.behavior = 'url(#default#homepage)';
document.body.setHomePage('http://chrui.iteye.com');
} else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("该操作被浏览器拒绝,如果想启用该功能,请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', 'http://chrui.iteye.com');
}
}
/* 添加收藏 */
function addCookie() {
if (document.all) {
window.external.addFavorite('http://chrui.iteye.com', 'ItEye--chrui blog');
} else if (window.sidebar) {
window.sidebar.addPanel('ItEye--chrui blog', 'http://chrui.iteye.com', "");
}
}
<link rel="Shortcut Icon" href="favicon.ico"/>
<link rel="Bookmark" href="favicon.ico"/>
<input type="button" value="查看源代码" onclick="window.location = 'view-source:'+ 'http://chrui.iteye.com'">
<META HTTP-EQUIV="pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 或者 <META HTTP-EQUIV="expires" CONTENT="0">
var regexp = "......";
if (regexp.test(email)) {
// 成功
} else {
// 失败
}
/**
* a.校验邮箱
*/
var emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;//来自于ExtJs
if (emailReg.test(email)) {
//成功
} else {
//失败
}
/**
* b.校验中文
*/
/*
双字节字符 /[^\x00-\xff]/
汉字 /[\u4e00-\u9fa5]/
*/
var chReg = /^[\u4e00-\u9fa5]+$/; //纯中文,如:"北京高森明晨信息科技有限公司"
var chReg = /^[\u4e00-\u9fa5]+\(*[\u4e00-\u9fa5]*\)*[\u4e00-\u9fa5]+$/; //李宁(中国)有限公司
/**
* c.校验英文
*/
var enReg = /^[A-Za-z]+$/;
/**
* c.校验数字
*/
var digitReg = /^[0-9]+$/;
var numreg = /^[1-9]{1}\d*$/; //数字应该是以1-9开始后跟零个或多个数字(0-9)
/**
* d.验证英文字母和数字
*/
var endigitReg = /^[A-Za-z]+[A-Za-z0-9]*$/
eformValidationMasks['NUMERIC'] = /^[0-9]+$/gi; // 数字
eformValidationMasks['INTEGER'] = /^-?\d+$/gi; // 整数
eformValidationMasks['DOUBLE'] = /^(-?\d+)(\.\d+)?$/gi; // 浮点数
var rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g; //来自于jQuery源码
function trim (text) {
return (text || "").replace( rtrim, "" );
}
转换成数字 xxx*1 转换成字符串 xxx+""
<Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)"> <Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)">