PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/jnode-httpd-module/resources/www/js/jnode.js

https://github.com/annmuor/jnode
JavaScript | 83 lines | 69 code | 8 blank | 6 comment | 15 complexity | 44bdca2cf1d71a84cbfe0076bc78151f MD5 | raw file
Possible License(s): Apache-2.0
  1. /**
  2. *
  3. * @author kreon
  4. *
  5. * Some functions were taken from stackoverflow.com
  6. */
  7. function _fill(name, val) {
  8. var _var = document.getElementById(name);
  9. if (_var) {
  10. if (_var.innerHTML) { // add
  11. _var.innerHTML += val;
  12. } else {
  13. _var.innerHTML = val;
  14. }
  15. }
  16. }
  17. function _clear(name) {
  18. var _var = document.getElementById(name);
  19. if (_var) {
  20. if (_var.innerHTML) { // add
  21. _var.innerHTML = "";
  22. }
  23. }
  24. }
  25. function _value(name, value) {
  26. var _var = document.getElementById(name);
  27. if (_var) {
  28. _var.value = value;
  29. }
  30. }
  31. function _var(name) {
  32. var _var = document.getElementById(name);
  33. if (_var) {
  34. return _var.value;
  35. } else {
  36. return null;
  37. }
  38. }
  39. function _getXmlHttp() {
  40. var xmlhttp;
  41. try {
  42. xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  43. } catch (e) {
  44. try {
  45. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  46. } catch (E) {
  47. xmlhttp = false;
  48. }
  49. }
  50. if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
  51. xmlhttp = new XMLHttpRequest();
  52. }
  53. return xmlhttp;
  54. }
  55. function _get(url) {
  56. var xmlhttp = _getXmlHttp()
  57. xmlhttp.open('GET', url, false);
  58. xmlhttp.send(null);
  59. if (xmlhttp.status == 200) {
  60. return xmlhttp.responseText;
  61. } else {
  62. return "";
  63. }
  64. }
  65. function _jrun(url, callback) {
  66. url += ((url.indexOf("?") >= 0) ? "&cb=" : "?cb=") + callback;
  67. eval(_get(url));
  68. }
  69. function _getParameterByName(name) {
  70. name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
  71. var regex = new RegExp("[\\?&#]" + name + "=([^&#]*)"), results = regex
  72. .exec(document.location.href);
  73. return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g,
  74. " "));
  75. }