JAVASCRIPT   27

cq default js

Guest on 23rd May 2022 01:41:53 AM

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

Raw Paste


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