Advertisement
mike2545

App.js

Jul 27th, 2014
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function setRadioButton(param,radioOnButton,radioOffButton,onWord){
  2.   if ( param == "1" ) { // or whatever other tests you want to do
  3.     document.getElementById(radioOnButton).checked='checked';
  4.   } else {
  5.     document.getElementById(radioOffButton).checked='checked';
  6.   }
  7. }
  8.  
  9. function fillSelectBoxesWithDates(){
  10.     var inputArr = document.getElementsByTagName("select");
  11.     for (var i = 0; i < inputArr.length; i++) {
  12.         if(inputArr[i].className.indexOf("hr") >-1) {
  13.             for(j=0 ;j<24;j++) {
  14.                 option=document.createElement("option");
  15.                 option.innerHTML = j;
  16.                 if(j<13)
  17.                     option.innerHTML=option.innerHTML+" AM";
  18.                 else
  19.                     option.innerHTML=option.innerHTML-12+" PM";
  20.                 option.value = j;
  21.                 if (option.value.length==1)
  22.                     option.value="0"+option.value;
  23.                 inputArr[i].add(option);
  24.  
  25.                 if(inputArr[i].className.substring(3,5)==option.value)
  26.                     inputArr[i].value=option.value;
  27.  
  28.             }
  29.         }
  30.         else if(inputArr[i].className.indexOf("min") >-1){
  31.             for(j=0 ;j<60;j++) {
  32.                 option=document.createElement("option");
  33.                 option.innerHTML = j;
  34.                 if (option.innerHTML.length==1)
  35.                     option.innerHTML="0"+option.innerHTML;
  36.                 option.value = j;
  37.                 if (option.value.length==1)
  38.                     option.value="0"+option.value;
  39.                 inputArr[i].add(option);
  40.                 if(inputArr[i].className.substring(7,9)==option.value)
  41.                     inputArr[i].value=option.value;
  42.  
  43.             }
  44.         }
  45.     }
  46. }
  47.  
  48. function createHour(hrSelect,minSelect,outputId){
  49.     var hour = document.getElementById(hrSelect);
  50.     var min = document.getElementById(minSelect);
  51.     document.getElementById(outputId).value=hour.options[hour.selectedIndex].value+':'+min.options[min.selectedIndex].value;
  52. }
  53.  
  54. function setDayOfWeek(selected){
  55.     $('#DoWSelect').val(selected.substring(1,2));
  56. }
  57.  
  58. function borderColourChange(isHeat){
  59.     var inputArr = document.getElementsByTagName("table");
  60.     for (var i = 0; i < inputArr.length; i++) {
  61.         if(isHeat){
  62.             inputArr[i].setAttribute("bordercolor","#FF6600");
  63.             document.body.bgColor="#FFF9F5";
  64.         }
  65.         else{
  66.             inputArr[i].setAttribute("bordercolor","#3399CC");
  67.             document.body.bgColor="#F7FBFD";
  68.         }
  69.     }
  70. }
  71.  
  72. function bloop(){
  73.     $.ajax({
  74.         url: "/ajax.html",
  75.         success:function(result){
  76.             var array=result.split(',');
  77.             for(i=0;i<array.length;i++){
  78.                 $("input[name='Nb_var"+array[i].substring(0,array[i].indexOf(':'))+"']").val(array[i].substring(array[i].indexOf(':')+1));
  79.             }
  80.         }});
  81.    
  82.     window.setTimeout(function(){bloop()}, 10000);
  83.    
  84. }
  85.  
  86. $( document ).ready(function() {
  87.     onPageLoad();
  88. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement