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

📄 actions.js

📁 一个页面界面的邮件程序
💻 JS
字号:
/* * GContact / PAUL Grégory * * In this file are functions to interact with actions (PHP) *//* * Request PHP with searched terms * @param terms to search */function askSearch(terms) {	var req = newXMLHttpRequest(), param = '';	var handlerFunction = getReadyStateHandler(req, showResult);	req.onreadystatechange = handlerFunction;  	req.open("POST", "actions/search.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	if (terms.value.length > 0)		param = "terms="+terms.value;	document.getElementById("content").innerHTML = msgWaiting;	req.send(param);	if (debug) trace("POST search.php terms="+terms.value);	return true;}/* * Verify if the 2 passwords fields are identical and then, ask PHP to change the password. * The password is hashed in database (MD5). */function changePassword () {	if (!verifyNotEmpty(new Array('password1', 'password2')))		return false;			var password1 = document.getElementById("password1"),		password2 = document.getElementById("password2");	if(password1.value != password2.value) {		alert(lbl_passwords_not_equals);		return false;	}	var req = newXMLHttpRequest(), param = '';	var handlerFunction = getReadyStateHandler(req, getPasswordChanged);	req.onreadystatechange = handlerFunction;	req.open("POST", "actions/changePassword.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	param = "&password=" + password1.value;	document.getElementById("content").innerHTML = msgWaiting;	req.send(param);	if (debug) trace("POST changePassword.php param="+param);	return true;}/* * Request PHP for persons in requested group * @param group id */function showGroup(id) {	var req = newXMLHttpRequest(), param = '';	var handlerFunction = getReadyStateHandler(req, showResult);	req.onreadystatechange = handlerFunction;  	req.open("POST", "actions/showPersonsFromGroup.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	param = "idgroup="+id;	document.getElementById("content").innerHTML = msgWaiting;	req.send(param);	if (debug) trace("POST showPersonsFromGroup.php param="+param);	return true;}/* * Request PHP to get birthdays (birthdays are sorted by next ones first) */function getBirthdays() {	var req = newXMLHttpRequest();	var handlerFunction = getReadyStateHandler(req, showBirthdays);	req.onreadystatechange = handlerFunction;  	req.open("POST", "actions/getBirthdays.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	document.getElementById("anniversaires").innerHTML = msgWaiting;	req.send('');	if (debug) trace("POST getBirthdays.php");	return true;}/* * Request PHP to get birthdays to print them (birthdays are sorted from january to december) */function getBirthdaysToPrint() {	var req = newXMLHttpRequest();	var handlerFunction = getReadyStateHandler(req, showBirthdaystoPrint);	req.onreadystatechange = handlerFunction;  	req.open("POST", "actions/getBirthdaysToPrint.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	document.getElementById("content").innerHTML = msgWaiting;	req.send('');	if (debug) trace("POST getBirthdaysToPrint.php");	return true;}/* * Request PHP to get user preferences */function getPreferencesForm() {	var req = newXMLHttpRequest();	var handlerFunction = getReadyStateHandler(req, showPreferences);	req.onreadystatechange = handlerFunction;  	req.open("POST", "actions/getPreferences.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	document.getElementById("content").innerHTML = msgWaiting;	req.send('');	if (debug) trace("POST getPreferences.php");	return true;}/* * Request PHP to update preferences */function changePreferences(nbField) {	var req = newXMLHttpRequest(), param = null, value = 0;	var handlerFunction = getReadyStateHandler(req, getPreferencesChanged);	req.onreadystatechange = handlerFunction;	for (var i = 0; i < 10; i++) {		var field = null;		if ((field = document.getElementById('daysBefore' + i)) == null) {			break;		} else {			if (field.checked == true)				value += Number(field.value);		}	}	req.open("POST", "actions/setPreferences.php", true);	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");	param = "&value=" + value;	document.getElementById("content").innerHTML = msgWaiting;	req.send(param);	if (debug) trace("POST setPreferences.php param="+param);	return true;}

⌨️ 快捷键说明

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