<script type="text/javascript" language="javascript">
function change(aa) {
var s=document.getElementById(aa);
s.οnfοcus=function(){if(this.value==this.defaultValue)this.value=''};
s.οnblur=function (){if(/^\s*$/.test(this.value)){this.value=this.defaultValue;this.style.color='#aaa'}}
s.οnkeydοwn=function(){ this.style.color='#000'}
}
function fEvent(sType,oInput){
switch (sType){
case "focus" :
oInput.isfocus = true;
case "mouseover" :
oInput.style.borderColor = '#99E300';
break;
case "blur" :
oInput.isfocus = false;
case "mouseout" :
if(!oInput.isfocus){
oInput.style.borderColor='#c4c4c4';
}
break;
}
}
//登陆验证
function entpLoginValidate(){
if(!entpValidate()){
return false;
}
if(getBrowserVersion()<7){
alert("您的浏览器为Internet Explorer "+getBrowserVersion()+", 本系统支持Internet Explorer 8及以上的版本,请升级Internet Explorer浏览器");
return false;
}
if(document.getElementById("entpAccount").value == ""){
alert("请输入用户名");
change("entpAccount");
return false;
}else if(document.getElementById("password").value == ""){
alert("请输入密码");
change("entpPassword");
return false;
}else if(document.getElementById("entpVerifyCode").value == ""){
alert("请输入验证码");
change("entpVerifyCode");
return false;
}else {
return true;
}
}
//登陆验证
function pedlarLoginValidate(){
if(!pedlarValidate()){
return false;
}
if(getBrowserVersion()<7){
alert("您的浏览器为Internet Explorer "+getBrowserVersion()+", 本系统支持Internet Explorer 8及以上的版本,请升级Internet Explorer浏览器");
return false;
}
if(document.getElementById("pedlarAccount").value == ""){
alert("请输入用户名");
change("pedlarAccount");
return false;
}else if(document.getElementById("loginPassword").value == ""){
alert("请输入密码");
change("loginPassword");
return false;
}else if(document.getElementById("pedlarVerifyCode").value == ""){
alert("请输入验证码");
change("pedlarVerifyCode");
return false;
}else {
return true;
}
}
function changeImg(){
var imgObj = document.getElementById("verifyImg");
//加时间戳,防止浏览器取缓存图片
imgObj.src= "verifyCode.action?timeStamp" + (new Date()).valueOf();
}
function changeEntpImg(){
var imgObj = document.getElementById("verifyImg_0");
//加时间戳,防止浏览器取缓存图片
imgObj.src= "verifyCode.action?timeStamp" + (new Date()).valueOf();
}
function changePedlarImg(){
var imgObj = document.getElementById("verifyImg_1");
//加时间戳,防止浏览器取缓存图片
imgObj.src= "verifyCode.action?timeStamp" + (new Date()).valueOf();
}
function entpNameIsZH(name){
var re = /[^\u4e00-\u9fa5]/;
if(re.test(name)) return false;
return true;
}
//密码校验
function entpValidate() {
var password = document.getElementsByName("password")[0].value;
if (password == "") {
alert("请输入密码!");
return false;
}
if (password.length < 6) {
alert("密码不能小于6位数!");
return false;
}
var regNum = /^(-?\d+)(\.\d+)?$/;
if (regNum.test(password)) {
alert("密码不能只包含数字!");
return false;
}
var regEn = /^[A-Za-z]+$/;
if (regEn.test(password)) {
alert("密码不能只包含英文!");
return false;
}
return true;
}
//密码校验
function pedlarValidate() {
return true;
var password = document.getElementsByName("password")[0].value;
if (password == "") {
alert("请输入密码!");
return false;
}
if (password.length < 6) {
alert("密码不能小于6位数!");
return false;
}
var regNum = /^(-?\d+)(\.\d+)?$/;
if (regNum.test(password)) {
alert("密码不能只包含数字!");
return false;
}
var regEn = /^[A-Za-z]+$/;
if (regEn.test(password)) {
alert("密码不能只包含英文!");
return false;
}
return true;
}
//登陆
function entpLogin(){
if(!entpLoginValidate()){
return;
}
var account = document.getElementById("entpAccount").value;
account = account.replace(/(/g, "(");
account = account.replace(/)/g, ")");
document.getElementById("entpAccount").value = account;
var e = document.entpEditForm;
e.submit();
}
//登陆
function pedlarLogin(){
if(!pedlarLoginValidate()){
return;
}
var account = document.getElementById("pedlarAccount").value;
account = account.replace(/(/g, "(");
account = account.replace(/)/g, ")");
document.getElementById("pedlarAccount").value = account;
var e = document.pedlarEditForm;
e.submit();
}
function trim(str){ //删除左右两端的空格
return str.replace(/(^\s*)|(\s*$)/g, "");
}
//获取浏览器版本
function getBrowserVersion()
{
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
window.ActiveXObject ? Sys.ie = ua.match(/msie ([\d.]+)/)[1] : 0;
if(Sys.ie) return(Sys.ie);
}
function nTabs(thisObj, Num) {
if (thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for (i = 0; i < tabList.length; i++) {
if (i == Num) {
thisObj.className = "active";
document.getElementById(tabObj + "_Content" + i).style.display = "block";
} else {
var imgObj = document.getElementById("verifyImg_" + Num);
imgObj.src= "verifyCode.action?timeStamp" + (new Date()).valueOf();
tabList[i].className = "normal";
document.getElementById(tabObj + "_Content" + i).style.display = "none";
}
}
}
</script>