314.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?
  2. session_start();
  3. echo "<meta charset=utf8>";
  4. if ($_SESSION['id'] == '' || $_SESSION['id'] == null) {
  5. echo '您尚未登入';
  6. exit;
  7. }
  8. include "connect.php";
  9. $userid = $_SESSION['name'];
  10. $sql = "SELECT User_ID,p314 FROM coursepagecount WHERE User_ID = '" . $userid . "'";
  11. $result = mysql_query($sql) or die('MySQL query error');
  12. $row = mysql_fetch_array($result);
  13. $num = $row[1] + 1;
  14. if ($num < 10) {
  15. $count = "0" . (string) ($num);
  16. } else {
  17. $count = "" . (string) ($num);
  18. }
  19. $sql = "UPDATE coursepagecount SET p314 = '" . $num . "' WHERE User_ID='" . $userid . "'";
  20. $result = mysql_query($sql) or die('MySQL query error');
  21. mysql_close($link);
  22. ?>
  23. <! DOCTYPE HTML>
  24. <html>
  25. <head>
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  27. <title>Exam</title>
  28. <link rel="stylesheet" type="text/css" media="all" href="style.css" />
  29. <script src="function.js"></script>
  30. <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
  31. <script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js"></script>
  32. <script src="jquery.ui.touch-punch.min.js"></script>
  33. <script src="../public/js/layui/layui.js"></script>
  34. <script src="layer.js"></script>
  35. <script type="text/javascript">
  36. saveRecord("33411<?echo $count ?>");
  37. picAisdroped = false;
  38. picBisdroped = false;
  39. picCisdroped = false;
  40. picDisdroped = false;
  41. answer1 = 0;
  42. error = 0;
  43. isStop = false;
  44. showPhototipStatus = false;
  45. showTooltipStatus = false;
  46. </script>
  47. <script>
  48. var dragId;
  49. $(document).ready(function(){
  50. $("#picA").draggable({
  51. drag: function(event, ui) {
  52. dragId = "picA";
  53. }
  54. });
  55. $("#picB").draggable({
  56. drag: function(event, ui) {
  57. dragId = "picB";
  58. }
  59. });
  60. $("#picC").draggable({
  61. drag: function(event, ui) {
  62. dragId = "picC";
  63. }
  64. });
  65. $("#picD").draggable({
  66. drag: function(event, ui) {
  67. dragId = "picD";
  68. }
  69. });
  70. $("#contentDiv").droppable({
  71. drop: function( event, ui ) {
  72. if(dragId == "picA"){
  73. picAisdroped = false;
  74. }
  75. else if(dragId == "picB"){
  76. picBisdroped = false;
  77. }
  78. else if(dragId == "picC"){
  79. picCisdroped = false;
  80. }
  81. else if(dragId == "picD"){
  82. picDisdroped = false;
  83. }
  84. }
  85. });
  86. $("#gridA").droppable({
  87. drop: function( event, ui ) {
  88. if(dragId == "picA"){
  89. saveRecords(1,dragTime);
  90. saveRecord(5);
  91. answer1 = 1;
  92. picAisdroped = true;
  93. }
  94. else if(dragId == "picB"){
  95. saveRecords(2,dragTime);
  96. saveRecord(5);
  97. answer1 = 2;
  98. picBisdroped = true;
  99. }
  100. else if(dragId == "picC"){
  101. saveRecords(3,dragTime);
  102. saveRecord(5);
  103. answer1 = 3;
  104. picCisdroped = true;
  105. }
  106. else if(dragId == "picD"){
  107. saveRecords(4,dragTime);
  108. saveRecord(5);
  109. answer1 = 4;
  110. picDisdroped = true;
  111. }
  112. document.getElementById(dragId).style.top = 40;
  113. document.getElementById(dragId).style.left = 550;
  114. }
  115. });
  116. });
  117. </script>
  118. <style type="text/css">
  119. #stockGraph{
  120. position: absolute;
  121. top:0;
  122. left:0;
  123. width:100%;
  124. height:30vh;
  125. background:rgba(100,100,100,0.4);
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div class="contentDiv">
  131. <div class="defaultPage" id="contentDiv">
  132. <canvas id="stockGraph">
  133. current stock price: $3.15 +0.15
  134. </canvas>
  135. <img class="defaultPic" id="contentPic" src="image/314q.jpg"/>
  136. <img class="picItemA" id="picA" src="image/314picA.png" style="top:380px;left:10px;" onmousedown="dragPic()"/>
  137. <img class="picItemB" id="picB" src="image/314picB.png" style="top:380px;left:200px;" onmousedown="dragPic()"/>
  138. <img class="picItemC" id="picC" src="image/314picC.png" style="top:380px;left:390px;" onmousedown="dragPic()"/>
  139. <img class="picItemD" id="picD" src="image/314picD.png" style="top:380px;left:580px;" onmousedown="dragPic()"/>
  140. <!--提示-->
  141. <!--<img class="phototip" id="phototip" src="image/314a_1.jpg" style="top:0px;left:10px;display:none;position: absolute"/>
  142. <img class="phototip" id="tooltip" src="image/314a_2.jpg" style="top:380px;left:580px;display:none"/>-->
  143. <img class="gridItemA" id="gridA" src="image/transparent.png" style="top:40px;left:550px; width:200px; height:165px"/>
  144. <button class="checkbutton" id="chkButton" onclick="checkAns(314)" style="top:275px;left:425px;" >確認答案</button>
  145. <button class="checkbutton" id="chkButton" onclick="tooltip('314a_1.jpg',1)" style="top:275px;left:550px;" >圖案提示</button>
  146. <button class="checkbutton" id="chkButton" onclick="tooltip('314a_2.jpg',2)"style="top:275px;left:675px;" >文字提示</button>
  147. <img class="defaultStatus" id="status" src="" style="top:260px;left:160px;"/>
  148. <img class="defaultHideBtn" id="buttonPrev" src="image/prevButton.jpg" onclick="nextPage(33419<?echo $count ?>,313)"/>
  149. <img class="defaultHideBtn" id="buttonNext" src="image/nextButton.jpg" onclick="nextPage(33419<?echo $count ?>,'314A')"/>
  150. </div>
  151. </div>
  152. <script>
  153. var canvas = document.getElementById('stockGraph');
  154. if (canvas.getContext){
  155. var ctx = canvas.getContext('2d');
  156. ctx.strokeStyle = '#ec6c09';
  157. ctx.lineWidth = 2;
  158. //实线1
  159. ctx.moveTo(30, 8);
  160. ctx.lineTo(150, 23);
  161. ctx.stroke();
  162. //实线2
  163. ctx.moveTo(150, 23);
  164. ctx.lineTo(60, 40);
  165. ctx.stroke();
  166. //虚线
  167. ctx.beginPath();
  168. ctx.setLineDash([5, 15]);
  169. ctx.moveTo(150, 23);
  170. ctx.lineTo(400, 20);
  171. ctx.stroke();
  172. // drawing code here
  173. } else {
  174. // canvas-unsupported code here
  175. }
  176. </script>
  177. </body>
  178. </html>