Guest User

Untitled

a guest
Jan 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <script>
  2. function allowDropi(ev)
  3. {
  4. ev.preventDefault();
  5. }
  6.  
  7. function dragi(ev)
  8. {
  9. ev.dataTransfer.setData("Text",ev.target.id);
  10. }
  11.  
  12. function dropi(ev)
  13. {
  14. ev.preventDefault();
  15. var data=ev.dataTransfer.getData("Text");
  16. ev.target.appendChild(document.getElementById(data));
  17.  
  18. result1=0;
  19.  
  20. if(ev.dataTransfer.getData("Text")==="drag2i")
  21. {
  22. result1++;
  23.  
  24. }
  25.  
  26.  
  27. if(ev.dataTransfer.getData("Text")==="dra2i")
  28. {
  29. result1++;
  30. }
  31.  
  32.  
  33. if(ev.dataTransfer.getData("Text")==="dr2i")
  34. {
  35. result1++;
  36. }
  37.  
  38.  
  39. if(ev.dataTransfer.getData("Text")==="2i")
  40. {
  41. result1++;
  42. }
  43.  
  44.  
  45. if(ev.dataTransfer.getData("Text")==="d2i")
  46. {
  47. result1++;
  48. }
  49.  
  50. document.getElementById('boldStuff6').innerHTML = result1;
  51. }
  52.  
  53. alert(result1);
  54.  
  55. </script>
  56.  
  57. this.result1 = ( this.result1 ) ? this.result1 : 0; // this will make sure it keeps old stored values from last time you call the function.
  58.  
  59. this.result1++; // or you can use ++this.result1; or even this.result1+=1;
Add Comment
Please, Sign In to add comment