PHP Classes

File: asf.js

Recommend this page to a friend!
  Classes of Dmitry Sheiko  >  AntiSpam Feedback  >  asf.js  >  Download  
File: asf.js
Role: Auxiliary data
Content type: text/plain
Description: JS library
Class: AntiSpam Feedback
Verify the e-mail of users sending feedback forms
Author: By
Last change: Delay before system message disappeared is increased
Date: 14 years ago
Size: 1,927 bytes
 

Contents

Class file image Download
/** * Send message * */ function SendMessage() { var post=""; for(i=1;i<document.asfeedback.length;i++) { if(document.asfeedback[i].type!=null && (document.asfeedback[i].type=="textarea" || document.asfeedback[i].type=="text" || document.asfeedback[i].type =="checkbox" )) post += document.asfeedback[i].name + "=" + document.asfeedback[i].value + "&"; } serverRequest("asf_controller.php", post, ProcessData); } var ProcessData = function(obj) { var respondStructure = eval( '(' + obj.responseText + ')' ); gmess = document.getElementById('GlobalMessage'); document.getElementById('GlobalMessageContent').innerHTML = respondStructure.content; gmess.style.display = "block"; window.setTimeout('gmess.style.display = "none";', 3600); }; /** * Create Request Object for various platforms * */ function createRequestObject() { var request = null; if(!request) try { request=new ActiveXObject('Msxml2.XMLHTTP'); } catch (e){} if(!request) try { request=new ActiveXObject('Microsoft.XMLHTTP'); } catch (e){} if(!request) try { request=new XMLHttpRequest(); } catch (e){} return request; } /** * Make server request * * @param POST-request performing * @param url - Request address * @param data - Parameters as a string * @param callback - (facultative) a callback-function */ function serverRequest(url, data, callback) { var request = createRequestObject(); if(!request) return false; request.onreadystatechange = function() { if(request.readyState == 4 && callback) callback(request); }; request.open('POST', url, true); request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); try { request.send(data); } catch (e) { alert('The server does not respond'); } return true; }