PageSourceSearch

https://opencounty.org/scripts/captchajx/ajax_captcha.js

js opencounty.org collected 2026-10-02 17:52:45 UTC 2,222 bytes, 67 lines download raw bytes

1//Gets the browser specific XmlHttpRequest Object 
2function getXmlHttpRequestObject() {
3 if (window.XMLHttpRequest) {
4    return new XMLHttpRequest(); //Mozilla, Safari ...
5 } else if (window.ActiveXObject) {
6    return new ActiveXObject("Microsoft.XMLHTTP"); //IE
7 } else {
8    //Display our error message
9    alert("Your browser doesn't support the XmlHttpRequest object.");
10 }
11}
12
13
14//Our XmlHttpRequest object
15var receiveReq = getXmlHttpRequestObject();
16
17
18//Initiate the AJAX request
19function makeRequest(url, param) {
20//If our readystate is either not started or finished, initiate a new request
21 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
22   //Set up the connection to captcha_test.html. True sets the request to asyncronous(default) 
23   receiveReq.open("POST", url, true);
24   //Set the function that will be called when the XmlHttpRequest objects state changes
25   receiveReq.onreadystatechange = updatePage; 
26
27   //Add HTTP headers to the request
28   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
29   receiveReq.setRequestHeader("Content-length", param.length);
30   receiveReq.setRequestHeader("Connection", "close");
31
32   //Make the request
33   receiveReq.send(param);
34 }   
35}
36
37
38//Called every time our XmlHttpRequest objects state changes
39function updatePage() {
40 //Check if our response is ready
41 if (receiveReq.readyState == 4) {
42   //Set the content of the DIV element with the response text
43   //document.getElementById('result').innerHTML = receiveReq.responseText;
44   //Get a reference to CAPTCHA image
45   img = document.getElementById('imgCaptcha'); 
46   //Change the image
47   img.src = 'scripts/captchajx/ajax_createimage.php?' + Math.random();
48 }
49}
50
51function captchaRefresh() {
52	img = document.getElementById('imgCaptcha'); 
53	img.src = 'scripts/captchajx/ajax_createimage.php?' + Math.random();
54}
55
56
57//Called every time when form is perfomed
58function getParam(theForm) {
59 //Set the URL
60 var url = 'scripts/captchajx/ajax_process.php';
61 //Set up the parameters of our AJAX call
62 var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value );
63 //Call the function that initiate the AJAX request
64 makeRequest(url, postStr);
65}
66
67

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.