JAVASCRIPT   19

cq default js

Guest on 13th August 2022 12:30:56 AM

  1. //================================================================================  
  2. // cq_default.js (depreciated)
  3. //================================================================================  
  4.  
  5. /*
  6. ##########!!!!!!!!!! CODE FOR TESTING !!!!!!!!!!##########
  7.  
  8. var something = "Testing...";
  9.  
  10. //prints to page
  11. document.write(something);
  12.  
  13.  
  14. //prints to alert window
  15. alert(something);
  16.  
  17. ##########!!!!!!!!!! CODE FOR TESTING !!!!!!!!!!##########
  18. */
  19.  
  20.  
  21. /*
  22. ##############################################################
  23. # Start Change HTML Functions
  24. ##############################################################
  25. */
  26.  
  27.  
  28. //----- Start Change CSS by Id-----
  29. function changeCssProperty (id,propertyname,newproperty) {
  30.  
  31. //alert("Test:" + id + propertyname + newproperty);
  32.  
  33.  
  34. document.getElementById(id).style[propertyname]=newproperty;
  35.  
  36.  
  37. //document.getElementById(id).style.backgroundColor=newproperty;
  38.  
  39.  
  40.  
  41. }
  42. //----- End Change CSS by Id-----
  43.  
  44.  
  45.  
  46. //----- Start Auto Toggle Display by ID-----//
  47.  
  48. function idAutoToggleDisplay(target_id) {
  49. //alert(target_id);
  50.  
  51. var dispalyType  = document.getElementById(target_id).style.display;
  52.  
  53.  
  54. //alert(target_id + "=" + dispalyType);
  55.  
  56.  
  57. if (dispalyType != "none") {
  58.  
  59. //alert('NONE');
  60. document.getElementById(target_id).style.display = "none";
  61. }
  62. else
  63. {
  64. document.getElementById(target_id).style.display = "block";
  65. }
  66.  
  67.  
  68. //alert('poop' + dispalyType);
  69.  
  70.  
  71. //idAutoToggleDisplay('criteria_search');
  72. //<button style="display:none;" id="criteria_search_button" onclick="idAutoToggleDisplay('mls_search');" s
  73. //document.getElementById('popupbox').style.backgroundColor="#FF0000";
  74.  
  75. }
  76. //----- end Auto Toggle Display by ID-----//
  77.  
  78.  
  79.  
  80.  
  81. //----- Start Toggle Display by Class-----
  82. function classToggleDisplay(displaystate,classname) {
  83.   var elements = document.getElementsByClassName(classname)
  84.     for (var i = 0; i < elements.length; i++){
  85.         elements[i].style.display = displaystate;
  86.         //elements[i].style.visibility = "hidden";
  87.     }
  88. }
  89. //----- End Toggle Display by Class-----
  90.  
  91.  
  92.  
  93. //----- Start Toggle Display by Id-----
  94. function idToggleDisplay(displaystate,id) {
  95.  document.getElementById(id).style.display = displaystate;
  96. }
  97. //----- End Toggle Display by Id-----
  98.  
  99.  
  100.  
  101. //----- Start Toggle Visibility by Class-----
  102. //visibilitystate: "hidden" or "visible"
  103. function classToggleVisibility(visibilitystate,classname) {
  104.   var elements = document.getElementsByClassName(classname)
  105.     for (var i = 0; i < elements.length; i++){
  106.         elements[i].style.visibility = visibilitystate;
  107.          }
  108. }
  109. //----- End Toggle Toggle Visibility by Class-----
  110.  
  111.  
  112.  
  113. //----- Start Toggle Visibility by Id-----
  114. //visibilitystate: "hidden" or "visible"
  115. function idToggleVisibility(visibilitystate,id) {
  116.         document.getElementById(id).style.visibility = visibilitystate;
  117. }
  118. //----- End Toggle Display by Id-----
  119.  
  120.  
  121.  
  122. //----- Start Change HTML/Text  -----
  123. function changeHTML(divspanid,newhtml)
  124. {
  125.         //alert(divspanid);
  126.         document.getElementById(divspanid).innerHTML=newhtml;
  127. }
  128.  
  129. function changeText(divspanid,newtext)
  130. {
  131.         //alert(divspanid);
  132.         document.getElementById(divspanid).textContent=newtext;
  133. }      
  134. //----- End Change HTML/Text  -----
  135.  
  136.  
  137.  
  138. //----- Start Change Form Value -----
  139. function changeFormValue(targetid,replacewithid) {
  140.  
  141. var newformvalue = document.getElementById(replacewithid).value;
  142.  
  143.  
  144. document.getElementById(targetid).value = newformvalue;
  145.  
  146.  
  147. }
  148. //----- End Change Form Value -----
  149.  
  150.  
  151.  
  152. //----- Start New Form Value -----
  153. function newFormValue(targetid,newformvalue) {
  154.  
  155. document.getElementById(targetid).value = newformvalue;
  156.  
  157. }
  158. //----- End New Form Value -----
  159.  
  160.  
  161. /*
  162. ##############################################################
  163. # End Change HTML Functions
  164. ##############################################################
  165. */
  166.  
  167. /*
  168. ##############################################################
  169. # Start Useful jQuery
  170. ##############################################################
  171. */
  172. // gets sum of array
  173. //var totalSumArr = [];
  174. //totalSumArr.push($(loopvartoadd).height()); // use to add to array n each loop
  175. //var sumOfArr=0;
  176. //for(var i in totalSumArr) {
  177. //  sumOfArr += totalSumArr[i];
  178. //}
  179. ////alert('sumOfArr: ' + sumOfArr);
  180. /*
  181. ##############################################################
  182. # #nd Useful jQuery
  183. ##############################################################
  184. */

Raw Paste


Login or Register to edit or fork this paste. It's free.