⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.js

📁 关于java web开发动态网页的资料
💻 JS
字号:
function IsEmpty(aTextField) 

{

   if ((aTextField.value.length==0) ||

   (aTextField.value==null)) {

      return true;

   }

   else { return false; }

}

 function isNumeric(strString)
   //  check for valid numeric strings	
   {
   var blnResult = true;
	   if (strString && !strString.match(/^\d{5}/))
         {
         blnResult = false;
         }

   return blnResult;
   }

   //==============================================  

function isValidEmail(str) 

{

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

 

}

//==================================================================

function IsEmpty(aTextField) {

   if ((aTextField.value.length==0) ||

   (aTextField.value==null)) {

      return true;

   }

   else { return false; }

}



 //============================================================

function isValidDate(dateStr) 

{

// Checks for the following valid date formats:

// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY

// Also separates date into month, day, and year variables



var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;



// To require a 4 digit year entry, use this line instead:

// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;



var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {

alert("Date is not in a valid format.")

return false;

}

month = matchArray[1]; // parse date into variables

day = matchArray[3];

year = matchArray[4];

if (month < 1 || month > 12) { // check month range

alert("Month must be between 1 and 12.");

return false;

}

if (day < 1 || day > 31) {

alert("Day must be between 1 and 31.");

return false;

}

if ((month==4 || month==6 || month==9 || month==11) && day==31) {

alert("Month "+month+" doesn't have 31 days!")

return false

}

if (month == 2) { // check for february 29th

var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));

if (day>29 || (day==29 && !isleap)) {

alert("February " + year + " doesn't have " + day + " days!");

return false;

   }

}

return true;  // date is valid

}

//======================================================================

function save_free_sign_up()

{	

	fname=document.getElementById('fname')//c_position
	lname=document.getElementById('lname')//c_position
	email=document.getElementById('email')
	 zip_str=document.contactform.zip.value;

	 if(fname.value=="")	

	{

		alert("Please enter First Name");

		fname.focus();

		return false;

	}

	else if(lname.value=="")	

	{

		alert("Please enter Last Name");

		lname.focus();

		return false;

	}
	
	else if(isValidEmail(email.value)==false)	

	{

		alert("Please enter valid Email");

		email.focus();

		return false;

	}
	else if(strString && !strString.match(/^\d{5}/))	

	{

		alert("Zip Code Should be Numeric");

		zip.focus();

		return false;

	}
	else

	{

		document.form1.action = "modify.php?mode=free_sign_up";
		window.document.form1.submit();

	}

}

//============================

function sf(id_name)

{

	id=document.getElementById(id_name);

	id.focus();

}
//////////////////////////////////
function left_section_go()
{
	email=document.getElementById('email')
	/*if(isValidEmail(email.value)==false)	
	{
		alert("Please enter valid Email");
		email.focus();
		return false;
	}
	else
	{*/
		document.left_form1.action = "free_sign_up.php";
		window.document.left_form1.submit();
	//}

}
////////////////////////////////////
function save_contact_us()
{	
	fname=document.getElementById('fname')//c_position
	lname=document.getElementById('lname')//c_position
	email2=document.getElementById('email2')
	phone=document.getElementById('phone')
	if(fname.value=="")	
	{
		alert("Please enter First Name");
		fname.focus();
		return false;
	}
	else if(lname.value=="")	
	{
		alert("Please enter Last Name");
		lname.focus();
		return false;
	}
	else if(phone.value=="")	
	{
		alert("Please enter Phone No.");
		phone.focus();
		return false;
	}
	else if(isValidEmail(email2.value)==false)	
	{
		alert("Please enter valid Email");
		email2.focus();
		return false;
	}
	else
	{
		document.form1.action = "modify.php?mode=save_contact_us";
		window.document.form1.submit();
	}
}

//////////////////////////////////////////////////////////////////////////

function save_sign_up()
{	
	fname=document.getElementById('fname')//c_position
	lname=document.getElementById('lname')//c_position
	address=document.getElementById('address')
	city=document.getElementById('city')
	state=document.getElementById('state')
	zip=document.getElementById('zip')
	email1=document.getElementById('email1')
	phone=document.getElementById('phone')
	password=document.getElementById('password')
	confirm_password=document.getElementById('confirm_password')
	if(fname.value=="")	
	{
		alert("Please enter First Name");
		fname.focus();
		return false;
	}
	if(lname.value=="")	
	{
		alert("Please enter Last Name");
		lname.focus();
		return false;
	}
	if(address.value=="")	
	{
		alert("Please enter Address");
		address.focus();
		return false;
	}
	if(city.value=="")	
	{
		alert("Please enter City");
		city.focus();
		return false;
	}
	if(state.value=="")	
	{
		alert("Please enter State");
		state.focus();
		return false;
	}
	if(IsNumeric(zip.value)==false)	
	{
		alert("Zip code should be numeric");
		zip.focus();
		return false;
	}
	if(IsNumeric(phone.value)==false)	
	{
		alert("Please enter Phone No.");
		phone.focus();
		return false;
	}
	if(isValidEmail(email1.value)==false)	
	{
		alert("Please enter valid Email");
		email1.focus();
		return false;
	}
	if(password.value!="" && confirm_password.value!="")	
	{
		if(password.value==confirm_password.value)	
		{
			document.form1.action = "modify.php?mode=save_sign_up";
			window.document.form1.submit();
		}
		else
		{
			alert("Passord Not Matching");
			password.focus();
			return false;
		}
	}
	else
	{
			alert("Please Enter password");
			password.focus();
			return false;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -