jhylands

LUCID time selection

Jan 31st, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 3.16 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script>
  4. function newval(){
  5.      alert('Running');
  6. //get the values
  7.      var erl = timetopx(parseFloat(document.getElementById('prestarth').value) + parseFloat(document.getElementById('prestartm').value) / 60);
  8.      var ideal = timetopx(parseFloat(document.getElementById('idealh').value) + parseFloat(document.getElementById('idealm').value) / 60);
  9.      var latre = timetopx(parseFloat(document.getElementById('lateh').value) + parseFloat(document.getElementById('latem').value) / 60);
  10.      var length = timetopx(parseFloat(document.getElementById('length').value));
  11. //Move the whole acordingly
  12.      var x = document.getElementById('maintime');
  13.      x.style.top = erl-464;
  14. //size the first cell
  15.      x = document.getElementById('maintimeE');
  16.      x.style.height = ideal - erl-2;
  17. //size the second to last cell
  18.      x = document.getElementById('maintimeFE');
  19.      x.style.height = ideal - erl-2;
  20. //size the middle unit
  21.      x = document.getElementById('maintimeM');
  22.      x.style.height = length - (latre-erl)-2;
  23. //size the second cell
  24.      x = document.getElementById('maintimeL');
  25.      x.style.height = latre - ideal-2;
  26. //size the last cell
  27.      x = document.getElementById('maintimeFL');
  28.      x.style.height = latre - ideal-2;
  29. }
  30. function timetopx(time){
  31. var px = time*19;
  32. return px;}//function takes the time in 0100 hours and turns it into a position reference
  33. </script>
  34. </head>
  35. <body>
  36. <ul><li>Times:hh:mm</li><li>Dates:dd/mm/yy</li><li>Length of time in hours</li></ul>
  37. <b> Earlyest:<input id="prestarth" maxlength=2 type="text" size="2"/>:<input id="prestartm" maxlength=2 type="text" size="2"/><input id="prestartd" maxlength=8 type="text" size="8"/></b><br />
  38. <b> Ideal: <input id="idealh" maxlength=2 type="text" size="2"/>:<input id="idealm" maxlength=2 type="text" size="2"/><input id="ideald" maxlength=8 type="text" size="8"/></b><br />
  39. <b> Latest:<input id="lateh" maxlength=2 type="text" size="2"/>:<input id="latem" maxlength=2 type="text" size="2"/><input id="lated" maxlength=8 type="text" size="8"/></b><br />
  40. <b>Length:</b><input id="length" type="text" /><br />
  41. <input type="button" value="Show" onclick="newval();"/>
  42.  
  43. <div  style="position:absolute;top:0px;left:300px;font-family:Arial;">
  44. <table id="alltime" border="1" style="width:220px;height:400px;overflow:scroll;" ><tr><td><div style="width:210px;height:390px;overflow:scroll;">
  45.  
  46. 00:00-</br>
  47. 01:00-</br>
  48. 02:00-</br>
  49. 03:00-</br>
  50. 04:00-</br>
  51. 05:00-</br>
  52. 06:00-</br>
  53. 07:00-</br>
  54. 08:00-</br>
  55. 09:00-</br>
  56. 10:00-</br>
  57. 11:00-</br>
  58. 12:00-</br>
  59. 13:00-</br>
  60. 14:00-</br>
  61. 15:00-</br>
  62. 16:00-</br>
  63. 17:00-</br>
  64. 18:00-</br>
  65. 19:00-</br>
  66. 20:00-</br>
  67. 21:00-</br>
  68. 22:00-</br>
  69. 23:00-</br>
  70. 24:00-<br/>
  71.  
  72. <table id="maintime"style="position:relative;background-color:#0099FF;top:-464px;right:-50px;width:136;height:114px;" >
  73. <tr id="maintimeE" height="10px"><td style="background-color:#19FFFF;"></td></tr>
  74. <tr id="maintimeL" height="10px"><td style="background-color:#19FFFF;"></td></tr>
  75. <tr id="maintimeM" ><td style="background-color:#19FFFF;"></td></tr>
  76. <tr id="maintimeFE" height="10px"><td style="background-color:#19FFFF;"></td></tr>
  77. <tr id="maintimeFL" height="10px"><td style="background-color:#19FFFF;"></td></tr></table>
  78. </div></td></tr></table>
  79.  
  80. </div>
Advertisement
Add Comment
Please, Sign In to add comment