hotspot.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // in je FORM-tag voor de hotspots: onSubmit="return validateFlashVar('MINIMUM_AANTAL_CLICKS');
  2. var flashVar = 0;
  3. var lcId = new Date().getTime();
  4. //var flashProxy = new FlashProxy(lcId, "JavaScriptFlashGateway.swf");
  5. function validateFlashVar(counter, lang_1, lang_2)
  6. {
  7. //alert(counter);
  8. //alert(flashVar);
  9. if(counter == flashVar)
  10. {
  11. alert (lang_1 + counter + lang_2);
  12. alert(lang_1);
  13. return false;
  14. }
  15. else
  16. {
  17. return true;
  18. }
  19. }
  20. function updateFlashVar()
  21. {
  22. alert('updateFlashVar: ' + flashVar);
  23. flashVar++;
  24. }
  25. function saveHotspot(question_id, hotspot_id, answer, hotspot_x, hotspot_y)
  26. {
  27. newHotspot = document.createElement("input");
  28. newHotspot.type = "hidden";
  29. newHotspot.name = "hotspot["+question_id+"]["+hotspot_id+"]";
  30. newHotspot.value = hotspot_x + ";" + hotspot_y;
  31. document.frm_exercise.appendChild(newHotspot);
  32. newHotspot = document.createElement("input");
  33. newHotspot.type = "hidden";
  34. newHotspot.name = "choice["+question_id+"]["+hotspot_id+"]";
  35. newHotspot.value = answer;
  36. document.frm_exercise.appendChild(newHotspot);
  37. }
  38. function saveShapeHotspot(question_id, hotspot_id, type, x, y, w, h)
  39. {
  40. document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = x + ";" + y + "|" + w + "|" + h;
  41. document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = type;
  42. }
  43. function savePolyHotspot(question_id, hotspot_id, coordinates)
  44. {
  45. document.frm_exercise["hotspot_coordinates["+hotspot_id+"]"].value = coordinates;
  46. document.frm_exercise["hotspot_type["+hotspot_id+"]"].value = "poly";
  47. }