Added utils.js
The utils.js file is an external javascript file that will make it easier to set attributes / do controls from more than one page.
This commit is contained in:
parent
9dadf082b4
commit
1b9af74cdc
25
html/utils.js
Normal file
25
html/utils.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
// Bryan Schumaker (12 / 27 / 2010)
|
||||||
|
|
||||||
|
function set_attr(attr)
|
||||||
|
{
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
req.onreadystatechange = function()
|
||||||
|
{
|
||||||
|
if (req.readyState == 4 && req.status == 200)
|
||||||
|
{
|
||||||
|
document.getElementById(attr).innerHTML = req.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
req.open('GET', "controls.py?a=" + attr, true)
|
||||||
|
req.send()
|
||||||
|
setTimeout("set_attr(\"" + attr + "\")", 3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_request(action)
|
||||||
|
{
|
||||||
|
var http = new XMLHttpRequest();
|
||||||
|
http.open('GET', "controls.py?a=" + action, true);
|
||||||
|
http.send();
|
||||||
|
return http;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user