Advertisement
Guest User

main.js

a guest
Dec 6th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. let stateM = 0;
  2. let stateS = 0;
  3.  
  4. function Sticky(name, hp, ac){
  5. this.name = name,
  6. this.hp = hp,
  7. this.ac = ac,
  8.  
  9. this.update = function(){
  10. this.hp--;
  11. },
  12.  
  13.  
  14.  
  15.  
  16. function dropDown() {
  17.  
  18. }
  19.  
  20. function monsterSearch() {
  21. document.getElementById("monster").innerHTML = '<input id = "nameInput" type = "text" placeholder="Monster Name"><input id = "hpInput" type = "number" placeholder="Hit Points"> <input id = "acInput" type = "number" placeholder="Armour Class"> <button onclick = "createNewSticky()">Create New Monster Sticky</button>';
  22. }
  23.  
  24. function createNewSticky(){
  25. let name = document.getElementById("nameInput").value;
  26. let hp = document.getElementById("hpInput").value;
  27. let ac = document.getElementById("acInput").value;
  28.  
  29. let newSticky = new Sticky(name, hp, ac);
  30. console.log(newSticky);
  31.  
  32. let newDiv = document.createElement('div');
  33.  
  34. newDiv.innerHTML = newSticky.name + ' ' + newSticky.hp + ' ' + newSticky.ac;
  35. document.body.appendChild(newDiv);
  36. }
  37.  
  38. function note() {
  39. let newNote = document.createElement("input");
  40. newNote.style.cssText = "width: 300px; height: 300px; color: black; left: 150px; top: 150px; position:absolute; vertical-align: top; ";
  41. document.body.appendChild(newNote);
  42. }
  43.  
  44. function spellSearch() {
  45. if (stateS == 0){
  46. document.getElementById("spells").innerHTML = "<input type='text' placeholder='Search Spells'>";
  47. stateS += 1
  48. }else if (stateS == 1){
  49. document.getElementById("spells").innerHTML = "Spells";
  50. stateS = 0;
  51. }
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement