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

📄 analog devices ad780 - 2_5 v-3_0 v ultrahigh precision bandgap voltage reference.htm

📁 这基准源常用的
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i < len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	alertMsg += name 
	return false;
	   }
	}
	
	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */
	
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	alertMsg += name 
	return false;
	}
	
	// Make sure there's a host name preceding the domain.
	
	if (len < 2) {
	alertMsg += name 
	return false;
	}
	
	// If we've gotten this far, everything's valid!
	return true;
	
}


 //file type validation. makes sure filename does not contain extensions for executable files
function NCH_limitExeFileAttach(file, name) {

	var extArray = new Array(".exe", ".dll", ".vbs", ".js", ".bat", ".wsf", ".cgi");

	allowSubmit = true;
	if (!file) return;
	while (file.indexOf("\\\\") != -1)
	file = file.slice(file.indexOf("\\\\") + 1);
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
	if (extArray[i] == ext) { allowSubmit = false; break; }
	}
	if (allowSubmit) {return true;}
	else
	{
		alertMsg += name ;
		return false;
	}
}


//image type validation

function NCH_limitAttach(file, name) {
	var extArray = new Array(".gif", ".jpg", ".jpeg");
	
	allowSubmit = false;
	if (!file) return false;
	ext = file.slice(file.lastIndexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = true; break; }
	}
	if (allowSubmit) 
		return true;
	alertMsg += name 
	return false;
}

// return the file extension

function NCH_getFileExtension(file)
{
	ext = "";
	ext = file.slice(file.lastIndexOf(".")).toLowerCase();
	return ext;
}

//TextCheck function for required fields

function NCH_textCheck(line, len, name)
 {
	 if (line.length < len) {
	 	alertMsg += name 
	 	return false;
	 } else {
 		return true;
 	}
}


// Number check functions for fields that take positive numbers greater than 0

function NCH_numberCheck(line, len, name)
 {
	 if (line.length < len || isNaN(parseInt(line)) || isNaN(line) || parseInt(line) == 0 ) {
	 	alertMsg += name 
	 	return false;
	 } else {
 		return true;
 	}
}

//Infosys: 16-Jan-2004
//To check whether a number is positive or not
function NCH_positiveIntegerCheck(num, msgName)
{ 	
	var count = 0;
	while(count < num.length)
	{
		if( (num.substring(count, count +1)) < '0' || (num.substring(count,count+1)) > '9' )
		{
			alertMsg += msgName;
			return false; //return false if number has any character other than '1' to '9'.
		}
		count++;
	}
	return true; //return true if valid integer. 
}
//End - Infosys: 16-Jan-2004


//Infosys: 12-Jan-2004
//To check whether a number is unique when an array of numbers is passed to it
function NCH_uniqueNumberCheck(num, arrNum, msgName)
{
	for(i=0 ; i<arrNum.length; i++)
	{	
		if(num == arrNum[i]) {
			alertMsg += msgName
			return false;
		}
	}
	return true;
}
//End - Infosys: 12-Jan-2004

// function to test for values greater than allowed length

function NCH_check_field_length(fieldLen, maxLen, fieldName) {
	if (fieldLen > maxLen) {
		alertMsg += "Error: You have entered " + fieldLen + " characters into the " + fieldName + " field. Total character count for this field cannot exceed " + maxLen + ". (This includes HTML tags.)" + "\n";
		return false;
	} else {
	return true;
	}
 }

 		
// ---------------------------------
// NAME:    NCH_deleteOption
// INPUTS:  listToDeleteFrom - list object that needs an item deleted
//          i - index of object to be deleted
//
// OUTPUTS: none
// DESCRIPTION: Deletes an option from the list object passed in
// ---------------------------------
function NCH_deleteOption(listToDeleteFrom, i)
{
	// delete the specific option from the list
	listToDeleteFrom.options[i] = null;
}

// ---------------------------------
// NAME:    NCH_doCompare
// INPUTS:  a - left side of compare
//          b - right side of compare
//
// OUTPUTS: integer
// DESCRIPTION: Compares two elements and returns an integer representing which is bigger.
// ---------------------------------
function NCH_doCompare(a, b)
{
	//Have to use a subscript on here as we are
	//sorting a selectionlist and we have text and value in
	//a two dimensional array
	if (a[1].toUpperCase() < b[1].toUpperCase()) return -1;
	if (a[1].toUpperCase() > b[1].toUpperCase()) return 1;
	return 0;
}

// ---------------------------------
// NAME:    NCH_sortList
// INPUTS:  selList - Selection list to be sorted
//
// OUTPUTS: integer
// DESCRIPTION: Sorts a selection list.
// ---------------------------------
function NCH_sortList(selList)
{
	var newList = new Array();
	var newOption;

	if (selList.options.length > 1)
	{
		// Go through the selection List putting the value/text into the
		// two dimensional array.
		for (var i = 0; i < selList.options.length; i++)
		{
			newList[i] = new Array(selList[i].value,selList[i].text);
		}
	
		// Sort the array using the NCH_doCompare Function
		newList.sort(NCH_doCompare);
	
		// Delete all options except the first one.
		for (var n = selList.options.length; n > -1; n--)
			NCH_deleteOption(selList,n);
	
		// Go through the array now making a list with the sorted value/text	
		for (var m = 0; m < newList.length; m++)
		{
			newOption = new Option(newList[m][1], newList[m][0], false, false);
			selList.options[selList.options.length] = newOption;
			selList.options[selList.options.length-1].selected = false;
		}
	}
};

// ---------------------------------
// NAME:    NCH_moveSelections
// INPUTS:  source - list to move selected options from
//          destination - list to move selected options to
//
// OUTPUTS: N/A
// DESCRIPTION: Moves selections from the source list to the destination list
// ---------------------------------
function NCH_moveSelections (source, destination)
{
	anySelected = false;
	
	// Check to see if we have any options selected
	for (var x = 0; x < source.length; x++)
	{
		if (source.options[x].selected)
		{
			anySelected = true;
		}
	}

	// Display alert to the user.
	if (!(anySelected))
    {	
      alert ("You must first select a valid Entry.");
      return;
    };
	
	// Start the code to move the selected source options to the destination list
    for (x = 0; x < source.length; x++)
    {
		while (source.options[x].selected)
		{
			// Get selected item
			text_to_add = source.options[x].text;
			value_to_add = source.options[x].value;
  
			// Add selected item to the member list
			destination.options[destination.length] = new Option (text_to_add,value_to_add);
		
			// Remove the selected initiator from the available list
			source.options[x] = null;
			
			if (x >= source.length)
			{
				break;
			}
		}
	}
	
	// sort the destination list
	NCH_sortList(destination);
};

// ---------------------------------
// NAME:    NCH_SelectList
// INPUTS:  listToSelect - Selection list to be selected
//
// OUTPUTS: N/A
// DESCRIPTION: Selects the full list.
// ---------------------------------
function NCH_SelectList (listToSelect)
{
	// Highlight all options in the list

⌨️ 快捷键说明

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