Jump to content

brooke_theperson

Members
  • Posts

    73
  • Joined

  • Last visited

Everything posted by brooke_theperson

  1. So, I have a general question. I learned javascript on codecademy, which doesn't teach much just very basic javascript concepts. This leaves me wondering how to do many basic things that could be applied to programs. One general question I have couldmake a program I am working on right now much cooler. My question is, how do use javascript to change the background-color of anything. I do not have a specific code to share, but here is my html: <!DOCTYPE html><html><head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script></head><body onclick = "change()"></body></html> My css: body{ background-color: blue} My javascript: function change(){ } Obviously this is just about as basic as it gets. My questions is how do I write the function to change the background-color? I know it is probably simple, but I have never learned. Please help.
  2. Just made an adjustment, here is the new html with slight changes: <!DOCTYPE html><html><head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script></head><body> <div class = "top"><div id = "randomtop"></div></div> <button id = "topright" onclick="toprightfnc()"><img class = "imgright" src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAEaCAMAAABtrpZTAAAAM1BMVEX///+/v7+8vLzd3d3b29vBwcHs7OzMzMz7+/vX19fr6+vOzs709PTExMTg4ODn5+f29vaQxP3sAAAC50lEQVR4nO3d227iQBCE4eCEZMkCyfs/7bKKUAz4MB5Puqviv665+DTqLkuW8Dw9FeR8LvmVVM5d54Y+d7udGfr5QjZDf5Gt0FeyEfqbbIPuk03Qt2QL9D3ZAP1IlkcPkcXRw2Rp9BhZGD1OvqCfs3WDmSKLoqfJkug5siD6ZZYsh54/ZTl0GVkKXUoWQpfMshh6CVkEvYwsgV5KFkAvJ6eja8jJ6DpyKrqWnIiuJ6eh15CT0OvIF/SLHTkBvZ4cjm5BDka3IceiPxqZQYMGDboWfXBEW540aNCgq/PuWHmgQYMGDRo0aNCgQYPeGPrVEf3eyAx6LpbjARo0aAV0I7Mp+q8jmpkGDRp0Hdqy8kCDFkFbLiJo0OM5NjLTHqBBr8jRsj1AR6EbmUHPoveG6FdHtOd4gAY9gebhEoW2rDzQoCfQjcygQcugLRcRtB36zRFNe4CeQAfO9KcjeuPtARq0BtqyPUCHoR1n2nIRPdEnQ/TZ71XvRyPxbrc/RpFbnTLkGPIn5ACy4WAYkg0HAzJkyJCLc/IjG54yZMiQ08iGJQf5V5GbvS2KWz/IkH+Y7Ld+HWTIg4EcQd7/gQz5Md3JkGy3fpAhD8dv/QxLzpBs2cuGZLvGgDyR8kuRZ8lRs9yMHPcoaUcO6+UtDwZkyJAhQ1YjB4k3fsp+5DfIAWTDwQgjt7rg25McJN42OawxIEOGfE+mlyEPksP+Crrp9YM8ngNkK3JYyUH2Ioc9Sja9fpAh/xpykBgy5B8nG64f5PG0ugo9kNwKHfl9qEboYHILdDh5/f3tCeS16BTyuvGI/AjvTerv5ksj1590Irn2pJNmeQ06mVyDTicvv5tPgLy0pyXIy9CpjdFP+UzLkMvRQuRStBS5DC1GLkGLNEY/cz0tSJ5DS5Kn0XKzfM04WpY8vojC5DG0NHkYLU4eQsuTH9EG5Pv2sCDfok3IfbQN+RttRL6irchft9Wakf+j7cgX9CFb0M8/kH9frqpfpFQAAAAASUVORK5CYII="></img></button> <button id = "topleft"><img class = "imgleft" src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1pyUMwdx_XBdS_318Mi-l39JKwwmrTJ6onBiVNM-WpyEul9Er"></img></button> <div class = "moretop"></div> <div class = "pants"></div> <button id = "pantsright"><img class = "imgright" src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAEaCAMAAABtrpZTAAAAM1BMVEX///+/v7+8vLzd3d3b29vBwcHs7OzMzMz7+/vX19fr6+vOzs709PTExMTg4ODn5+f29vaQxP3sAAAC50lEQVR4nO3d227iQBCE4eCEZMkCyfs/7bKKUAz4MB5Puqviv665+DTqLkuW8Dw9FeR8LvmVVM5d54Y+d7udGfr5QjZDf5Gt0FeyEfqbbIPuk03Qt2QL9D3ZAP1IlkcPkcXRw2Rp9BhZGD1OvqCfs3WDmSKLoqfJkug5siD6ZZYsh54/ZTl0GVkKXUoWQpfMshh6CVkEvYwsgV5KFkAvJ6eja8jJ6DpyKrqWnIiuJ6eh15CT0OvIF/SLHTkBvZ4cjm5BDka3IceiPxqZQYMGDboWfXBEW540aNCgq/PuWHmgQYMGDRo0aNCgQYPeGPrVEf3eyAx6LpbjARo0aAV0I7Mp+q8jmpkGDRp0Hdqy8kCDFkFbLiJo0OM5NjLTHqBBr8jRsj1AR6EbmUHPoveG6FdHtOd4gAY9gebhEoW2rDzQoCfQjcygQcugLRcRtB36zRFNe4CeQAfO9KcjeuPtARq0BtqyPUCHoR1n2nIRPdEnQ/TZ71XvRyPxbrc/RpFbnTLkGPIn5ACy4WAYkg0HAzJkyJCLc/IjG54yZMiQ08iGJQf5V5GbvS2KWz/IkH+Y7Ld+HWTIg4EcQd7/gQz5Md3JkGy3fpAhD8dv/QxLzpBs2cuGZLvGgDyR8kuRZ8lRs9yMHPcoaUcO6+UtDwZkyJAhQ1YjB4k3fsp+5DfIAWTDwQgjt7rg25McJN42OawxIEOGfE+mlyEPksP+Crrp9YM8ngNkK3JYyUH2Ioc9Sja9fpAh/xpykBgy5B8nG64f5PG0ugo9kNwKHfl9qEboYHILdDh5/f3tCeS16BTyuvGI/AjvTerv5ksj1590Irn2pJNmeQ06mVyDTicvv5tPgLy0pyXIy9CpjdFP+UzLkMvRQuRStBS5DC1GLkGLNEY/cz0tSJ5DS5Kn0XKzfM04WpY8vojC5DG0NHkYLU4eQsuTH9EG5Pv2sCDfok3IfbQN+RttRL6irchft9Wakf+j7cgX9CFb0M8/kH9frqpfpFQAAAAASUVORK5CYII="></img></button> <button id = "pantsleft"><img class = "imgleft" src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1pyUMwdx_XBdS_318Mi-l39JKwwmrTJ6onBiVNM-WpyEul9Er"></img></button> <div class = "morepants"></div> <div class = "shoes"></div> <button id = "shoesright"><img class = "imgright" src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAEaCAMAAABtrpZTAAAAM1BMVEX///+/v7+8vLzd3d3b29vBwcHs7OzMzMz7+/vX19fr6+vOzs709PTExMTg4ODn5+f29vaQxP3sAAAC50lEQVR4nO3d227iQBCE4eCEZMkCyfs/7bKKUAz4MB5Puqviv665+DTqLkuW8Dw9FeR8LvmVVM5d54Y+d7udGfr5QjZDf5Gt0FeyEfqbbIPuk03Qt2QL9D3ZAP1IlkcPkcXRw2Rp9BhZGD1OvqCfs3WDmSKLoqfJkug5siD6ZZYsh54/ZTl0GVkKXUoWQpfMshh6CVkEvYwsgV5KFkAvJ6eja8jJ6DpyKrqWnIiuJ6eh15CT0OvIF/SLHTkBvZ4cjm5BDka3IceiPxqZQYMGDboWfXBEW540aNCgq/PuWHmgQYMGDRo0aNCgQYPeGPrVEf3eyAx6LpbjARo0aAV0I7Mp+q8jmpkGDRp0Hdqy8kCDFkFbLiJo0OM5NjLTHqBBr8jRsj1AR6EbmUHPoveG6FdHtOd4gAY9gebhEoW2rDzQoCfQjcygQcugLRcRtB36zRFNe4CeQAfO9KcjeuPtARq0BtqyPUCHoR1n2nIRPdEnQ/TZ71XvRyPxbrc/RpFbnTLkGPIn5ACy4WAYkg0HAzJkyJCLc/IjG54yZMiQ08iGJQf5V5GbvS2KWz/IkH+Y7Ld+HWTIg4EcQd7/gQz5Md3JkGy3fpAhD8dv/QxLzpBs2cuGZLvGgDyR8kuRZ8lRs9yMHPcoaUcO6+UtDwZkyJAhQ1YjB4k3fsp+5DfIAWTDwQgjt7rg25McJN42OawxIEOGfE+mlyEPksP+Crrp9YM8ngNkK3JYyUH2Ioc9Sja9fpAh/xpykBgy5B8nG64f5PG0ugo9kNwKHfl9qEboYHILdDh5/f3tCeS16BTyuvGI/AjvTerv5ksj1590Irn2pJNmeQ06mVyDTicvv5tPgLy0pyXIy9CpjdFP+UzLkMvRQuRStBS5DC1GLkGLNEY/cz0tSJ5DS5Kn0XKzfM04WpY8vojC5DG0NHkYLU4eQsuTH9EG5Pv2sCDfok3IfbQN+RttRL6irchft9Wakf+j7cgX9CFb0M8/kH9frqpfpFQAAAAASUVORK5CYII="></img></button> <button id = "shoesleft"><img class = "imgleft" src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1pyUMwdx_XBdS_318Mi-l39JKwwmrTJ6onBiVNM-WpyEul9Er"></img></button> <div class = "moreshoes"></div></body></html> I just changed the arrows to button, I still am having the same problem, the function doesn't work. Please help.
  3. Hey so I am creating just a fun program where you can mix and match different tops, pants, and shoes. When you click an arrow button it changes the top, pants, or shoes. My code is not work. Please help, I think the problem is the way the link are placed. Please help. Here is my html: <!DOCTYPE html><html><head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script></head><body> <div class = "top"><div id = "randomtop"></div></div> <div id = "topright" onclick="toprightfnc()"><img class = "imgright" src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAEaCAMAAABtrpZTAAAAM1BMVEX///+/v7+8vLzd3d3b29vBwcHs7OzMzMz7+/vX19fr6+vOzs709PTExMTg4ODn5+f29vaQxP3sAAAC50lEQVR4nO3d227iQBCE4eCEZMkCyfs/7bKKUAz4MB5Puqviv665+DTqLkuW8Dw9FeR8LvmVVM5d54Y+d7udGfr5QjZDf5Gt0FeyEfqbbIPuk03Qt2QL9D3ZAP1IlkcPkcXRw2Rp9BhZGD1OvqCfs3WDmSKLoqfJkug5siD6ZZYsh54/ZTl0GVkKXUoWQpfMshh6CVkEvYwsgV5KFkAvJ6eja8jJ6DpyKrqWnIiuJ6eh15CT0OvIF/SLHTkBvZ4cjm5BDka3IceiPxqZQYMGDboWfXBEW540aNCgq/PuWHmgQYMGDRo0aNCgQYPeGPrVEf3eyAx6LpbjARo0aAV0I7Mp+q8jmpkGDRp0Hdqy8kCDFkFbLiJo0OM5NjLTHqBBr8jRsj1AR6EbmUHPoveG6FdHtOd4gAY9gebhEoW2rDzQoCfQjcygQcugLRcRtB36zRFNe4CeQAfO9KcjeuPtARq0BtqyPUCHoR1n2nIRPdEnQ/TZ71XvRyPxbrc/RpFbnTLkGPIn5ACy4WAYkg0HAzJkyJCLc/IjG54yZMiQ08iGJQf5V5GbvS2KWz/IkH+Y7Ld+HWTIg4EcQd7/gQz5Md3JkGy3fpAhD8dv/QxLzpBs2cuGZLvGgDyR8kuRZ8lRs9yMHPcoaUcO6+UtDwZkyJAhQ1YjB4k3fsp+5DfIAWTDwQgjt7rg25McJN42OawxIEOGfE+mlyEPksP+Crrp9YM8ngNkK3JYyUH2Ioc9Sja9fpAh/xpykBgy5B8nG64f5PG0ugo9kNwKHfl9qEboYHILdDh5/f3tCeS16BTyuvGI/AjvTerv5ksj1590Irn2pJNmeQ06mVyDTicvv5tPgLy0pyXIy9CpjdFP+UzLkMvRQuRStBS5DC1GLkGLNEY/cz0tSJ5DS5Kn0XKzfM04WpY8vojC5DG0NHkYLU4eQsuTH9EG5Pv2sCDfok3IfbQN+RttRL6irchft9Wakf+j7cgX9CFb0M8/kH9frqpfpFQAAAAASUVORK5CYII="></img></div> <div id = "topleft"><img class = "imgleft" src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1pyUMwdx_XBdS_318Mi-l39JKwwmrTJ6onBiVNM-WpyEul9Er"></img></div> <div class = "moretop"></div> <div class = "pants"></div> <div id = "pantsright"><img class = "imgright" src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAEaCAMAAABtrpZTAAAAM1BMVEX///+/v7+8vLzd3d3b29vBwcHs7OzMzMz7+/vX19fr6+vOzs709PTExMTg4ODn5+f29vaQxP3sAAAC50lEQVR4nO3d227iQBCE4eCEZMkCyfs/7bKKUAz4MB5Puqviv665+DTqLkuW8Dw9FeR8LvmVVM5d54Y+d7udGfr5QjZDf5Gt0FeyEfqbbIPuk03Qt2QL9D3ZAP1IlkcPkcXRw2Rp9BhZGD1OvqCfs3WDmSKLoqfJkug5siD6ZZYsh54/ZTl0GVkKXUoWQpfMshh6CVkEvYwsgV5KFkAvJ6eja8jJ6DpyKrqWnIiuJ6eh15CT0OvIF/SLHTkBvZ4cjm5BDka3IceiPxqZQYMGDboWfXBEW540aNCgq/PuWHmgQYMGDRo0aNCgQYPeGPrVEf3eyAx6LpbjARo0aAV0I7Mp+q8jmpkGDRp0Hdqy8kCDFkFbLiJo0OM5NjLTHqBBr8jRsj1AR6EbmUHPoveG6FdHtOd4gAY9gebhEoW2rDzQoCfQjcygQcugLRcRtB36zRFNe4CeQAfO9KcjeuPtARq0BtqyPUCHoR1n2nIRPdEnQ/TZ71XvRyPxbrc/RpFbnTLkGPIn5ACy4WAYkg0HAzJkyJCLc/IjG54yZMiQ08iGJQf5V5GbvS2KWz/IkH+Y7Ld+HWTIg4EcQd7/gQz5Md3JkGy3fpAhD8dv/QxLzpBs2cuGZLvGgDyR8kuRZ8lRs9yMHPcoaUcO6+UtDwZkyJAhQ1YjB4k3fsp+5DfIAWTDwQgjt7rg25McJN42OawxIEOGfE+mlyEPksP+Crrp9YM8ngNkK3JYyUH2Ioc9Sja9fpAh/xpykBgy5B8nG64f5PG0ugo9kNwKHfl9qEboYHILdDh5/f3tCeS16BTyuvGI/AjvTerv5ksj1590Irn2pJNmeQ06mVyDTicvv5tPgLy0pyXIy9CpjdFP+UzLkMvRQuRStBS5DC1GLkGLNEY/cz0tSJ5DS5Kn0XKzfM04WpY8vojC5DG0NHkYLU4eQsuTH9EG5Pv2sCDfok3IfbQN+RttRL6irchft9Wakf+j7cgX9CFb0M8/kH9frqpfpFQAAAAASUVORK5CYII="></img></div> <div id = "pantsleft"><img class = "imgleft" src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1pyUMwdx_XBdS_318Mi-l39JKwwmrTJ6onBiVNM-WpyEul9Er"></img></div> <div class = "morepants"></div> <div class = "shoes"></div> <div id = "shoesright"><img class = "imgright" src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALMAAAEaCAMAAABtrpZTAAAAM1BMVEX///+/v7+8vLzd3d3b29vBwcHs7OzMzMz7+/vX19fr6+vOzs709PTExMTg4ODn5+f29vaQxP3sAAAC50lEQVR4nO3d227iQBCE4eCEZMkCyfs/7bKKUAz4MB5Puqviv665+DTqLkuW8Dw9FeR8LvmVVM5d54Y+d7udGfr5QjZDf5Gt0FeyEfqbbIPuk03Qt2QL9D3ZAP1IlkcPkcXRw2Rp9BhZGD1OvqCfs3WDmSKLoqfJkug5siD6ZZYsh54/ZTl0GVkKXUoWQpfMshh6CVkEvYwsgV5KFkAvJ6eja8jJ6DpyKrqWnIiuJ6eh15CT0OvIF/SLHTkBvZ4cjm5BDka3IceiPxqZQYMGDboWfXBEW540aNCgq/PuWHmgQYMGDRo0aNCgQYPeGPrVEf3eyAx6LpbjARo0aAV0I7Mp+q8jmpkGDRp0Hdqy8kCDFkFbLiJo0OM5NjLTHqBBr8jRsj1AR6EbmUHPoveG6FdHtOd4gAY9gebhEoW2rDzQoCfQjcygQcugLRcRtB36zRFNe4CeQAfO9KcjeuPtARq0BtqyPUCHoR1n2nIRPdEnQ/TZ71XvRyPxbrc/RpFbnTLkGPIn5ACy4WAYkg0HAzJkyJCLc/IjG54yZMiQ08iGJQf5V5GbvS2KWz/IkH+Y7Ld+HWTIg4EcQd7/gQz5Md3JkGy3fpAhD8dv/QxLzpBs2cuGZLvGgDyR8kuRZ8lRs9yMHPcoaUcO6+UtDwZkyJAhQ1YjB4k3fsp+5DfIAWTDwQgjt7rg25McJN42OawxIEOGfE+mlyEPksP+Crrp9YM8ngNkK3JYyUH2Ioc9Sja9fpAh/xpykBgy5B8nG64f5PG0ugo9kNwKHfl9qEboYHILdDh5/f3tCeS16BTyuvGI/AjvTerv5ksj1590Irn2pJNmeQ06mVyDTicvv5tPgLy0pyXIy9CpjdFP+UzLkMvRQuRStBS5DC1GLkGLNEY/cz0tSJ5DS5Kn0XKzfM04WpY8vojC5DG0NHkYLU4eQsuTH9EG5Pv2sCDfok3IfbQN+RttRL6irchft9Wakf+j7cgX9CFb0M8/kH9frqpfpFQAAAAASUVORK5CYII="></img></div> <div id = "shoesleft"><img class = "imgleft" src = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1pyUMwdx_XBdS_318Mi-l39JKwwmrTJ6onBiVNM-WpyEul9Er"></img></div> <div class = "moreshoes"></div></body></html> And here is my javascript: function picture(img) { this.link = link;}//*All clothingvar top = new picture(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQqsdG9ZJSEOvFjdUC3Z8SpHh02ML1kbmoq-zF8thO6OiPRESR_);var top2 = new picture(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQqsdG9ZJSEOvFjdUC3Z8SpHh02ML1kbmoq-zF8thO6OiPRESR_);var pants = new picture();var pants2 = new picture();var shoes = new picture();var shoes2 = new picture();//*All topsvar tops = [top, top2];//*All pantsvar pants = [pants, pants2];//*All shoesvar shoes = [shoes, shoes2];//*topright random generatorfunction toprightfnc(){ var random = Math.floor(Math.random() * tops.length); var tops_generate = tops[random]; document.getElementById("randomtop").innerHTML = tops_generate.link;} Why isn't it working?
  4. Thanks for all the help. Where I learned javascript it didn't teach how to incorporate it in html as well, I think that is why I was having so much trouble. Using these basics that you showed me, I was able to expand my program a lot. Thanks for all the help.
  5. Alright, i figured it out so that it does say "translate: gato" and the answer does come up as correct or incorrect. It works perfect. Now I just have one thing, please explain to me why we need var word_obj = words[num];. Thanks so much for the help!!
  6. This makes sense, but one part is confusing. Can you explain why this is necessary: var word_obj = words[num]; Also, when I click the button, the prompt is now "translate: undefined".
  7. I just added something, but still when I type in "cat" in response to "translate: gato". It comes up as incorrect. Also, with what I just added the correct answer should show up as well, but it doesn't. What I added to javascript was another "document.getElementById" that says the correct word: function spanishWord(){ var word = prompt("Translate: " + rgs); if (rgs.english){ document.getElementById("correct").innerHTML = "correct"; } else{ document.getElementById("incorrect").innerHTML = "incorrect"; document.getElementById("CorrectAnswer").innerHTML = rgs.english; }} What I added to html was simply another div with the id "CorrectAnswer": <div class="CorrectIncorrect"> <div id = "correct"><div id = "incorrect"><div id = "CorrectAnswer"></div></div></div> </div> Still the only thing that comes up in the "CorrectIncorrect" div is "incorrect". Please help.
  8. Thank you. I took what you said into consideration, I think I have found something that works. By the way, I am only a beginner, so sorry about all the questions, I am just not very experienced but trying to learn as much as possible. I have created this code: function word(spanish, english) { this.spanish = spanish; this.english = english;}var gato = new word("gato", "cat")var perro = new word("perro", "dog")var hola = new word("hola", "hello")var cat = new word("gato", "cat")var dog = new word("perro", "dog")var hello = new word("hola", "hello")var spanishWords = [gato.spanish, perro.spanish, hola.spanish];var englishWords = [cat.english, dog.english, hello.english,];//Random Generate Functionvar rgs = spanishWords[Math.floor(Math.random() * spanishWords.length)];var rge = englishWords[Math.floor(Math.random() * spanishWords.length)];// Prompt the user for a wordfunction spanishWord(){ var word = prompt("Translate: " + rgs); if (rgs.english){ document.getElementById("correct").innerHTML = "correct"; } else{ document.getElementById("incorrect").innerHTML = "incorrect"; } }function englishWord(){ var word = prompt("Translate: " + rge); if (rge.spanish){ document.getElementById("correct").innerHTML = "correct"; } else{ document.getElementById("incorrect").innerHTML = "incorrect"; }} This works for the most part, except when it says to translate "gato", I enter "cat" and it logs "incorrect". Also I do not know how to generate a new random number each time the function runs. Also, since this deals with HTML as well, here is my HTML code: <!DOCTYPE html><html><head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script></head><body><div class = "border"><div class = "border2"> <div class = "header"> <h3>Espanol Practice Program</h3> </div> <div class = "search"> <button class = "spanish" onclick="spanishWord()"> Spanish </button> <button class = "english"onclick="englishWord()"> English </button> </div> <div class = "body"> <div class="dot1"><div class = "d1"></div></div> <div class="dot2"><div class = "d1"></div></div> <div class="dot3"><div class = "d1"></div></div> <div class="dot4"><div class = "d1"></div></div> <div class="dot5"><div class = "d1"></div></div> <div class="dot6"><div class = "d1"></div></div> <div class="dot7"><div class = "d1"></div></div> <div class="dot8"><div class = "d1"></div></div> <div class="dot9"><div class = "d1"></div></div> <div class="dot10"><div class = "d1"></div></div> <div class="dot11"><div class = "d1"></div></div> <div class="dot12"><div class = "d1"></div></div> <div class="dot13"><div class = "d1"></div></div> <div class="dot14"><div class = "d1"></div></div> <div class="dot15"><div class = "d1"></div></div> <div class="dot16"><div class = "d1"></div></div> <div class="dot17"><div class = "d1"></div></div> <div class="dot18"><div class = "d1"></div></div> <div class="dot19"><div class = "d1"></div></div> <div class="dot20"><div class = "d1"></div></div> <div class="dot21"><div class = "d1"></div></div> <div class="dot22"><div class = "d1"></div></div> <div class="dot23"><div class = "d1"></div></div> <div class="dot24"><div class = "d1"></div></div> <div class="dot25"><div class = "d1"></div></div> <div class="dot26"><div class = "d1"></div></div> <div class="dot27"><div class = "d1"></div></div> <div class="dot28"><div class = "d1"></div></div> <div class="dot29"><div class = "d1"></div></div> <div class="dot30"><div class = "d1"></div></div> <div class="dot31"><div class = "d1"></div></div> <div class="dot32"><div class = "d1"></div></div> <div class="dot33"><div class = "d1"></div></div> <div class="dot34"><div class = "d1"></div></div> <div class="dot35"><div class = "d1"></div></div> <div class="dot36"><div class = "d1"></div></div> <div class="dot37"><div class = "d1"></div></div> <div class="dot38"><div class = "d1"></div></div> <div class="dot39"><div class = "d1"></div></div> <div class="dot40"><div class = "d1"></div></div> <div class="dot41"><div class = "d1"></div></div> <div class="dot42"><div class = "d1"></div></div> <div class="dot43"><div class = "d1"></div></div> <div class="dot44"><div class = "d1"></div></div> <div class="dot45"><div class = "d1"></div></div> <div class="dot46"><div class = "d1"></div></div> <div class="dot47"><div class = "d1"></div></div> <div class="dot48"><div class = "d1"></div></div> <div class="dot49"><div class = "d1"></div></div> <div class="dot50"><div class = "d1"></div></div> <div class="dot51"><div class = "d1"></div></div> <div class="dot52"><div class = "d1"></div></div> <div class="dot53"><div class = "d1"></div></div> <div class="dot54"><div class = "d1"></div></div> <div class="dot55"><div class = "d1"></div></div> <div class="dot56"><div class = "d1"></div></div> <div class="dot57"><div class = "d1"></div></div> <div class="dot58"><div class = "d1"></div></div> <div class="dot59"><div class = "d1"></div></div> <div class="dot60"><div class = "d1"></div></div> <div class="dot61"><div class = "d1"></div></div> <div class="dot62"><div class = "d1"></div></div> <div class="dot63"><div class = "d1"></div></div> <div class="dot64"><div class = "d1"></div></div> <div class="dot65"><div class = "d1"></div></div> <div class="dot66"><div class = "d1"></div></div> <div class="CorrectIncorrect"> <div id = "correct"><div id = "incorrect"></div></div> </div> <div class="dot101"><div class = "d1"></div></div> <div class="dot102"><div class = "d1"></div></div> <div class="dot103"><div class = "d1"></div></div> <div class="dot104"><div class = "d1"></div></div> <div class="dot105"><div class = "d1"></div></div> <div class="dot106"><div class = "d1"></div></div> <div class="dot107"><div class = "d1"></div></div> <div class="dot108"><div class = "d1"></div></div> <div class="dot109"><div class = "d1"></div></div> <div class="dot110"><div class = "d1"></div></div> <div class="dot111"><div class = "d1"></div></div> <div class="dot112"><div class = "d1"></div></div> <div class="dot113"><div class = "d1"></div></div> <div class="dot114"><div class = "d1"></div></div> <div class="dot115"><div class = "d1"></div></div> <div class="dot116"><div class = "d1"></div></div> <div class="dot117"><div class = "d1"></div></div> <div class="dot118"><div class = "d1"></div></div> <div class="dot119"><div class = "d1"></div></div> <div class="dot120"><div class = "d1"></div></div> <div class="dot121"><div class = "d1"></div></div> <div class="dot122"><div class = "d1"></div></div> <div class="dot123"><div class = "d1"></div></div> <div class="dot124"><div class = "d1"></div></div> <div class="dot125"><div class = "d1"></div></div> <div class="dot126"><div class = "d1"></div></div> <div class="dot127"><div class = "d1"></div></div> <div class="dot128"><div class = "d1"></div></div> <div class="dot129"><div class = "d1"></div></div> <div class="dot130"><div class = "d1"></div></div> <div class="dot131"><div class = "d1"></div></div> <div class="dot132"><div class = "d1"></div></div> <div class="dot133"><div class = "d1"></div></div> <div class="dot134"><div class = "d1"></div></div> <div class="dot135"><div class = "d1"></div></div> <div class="dot136"><div class = "d1"></div></div> <div class="dot137"><div class = "d1"></div></div> <div class="dot138"><div class = "d1"></div></div> <div class="dot139"><div class = "d1"></div></div> <div class="dot140"><div class = "d1"></div></div> <div class="dot141"><div class = "d1"></div></div> <div class="dot142"><div class = "d1"></div></div> <div class="dot143"><div class = "d1"></div></div> <div class="dot144"><div class = "d1"></div></div> <div class="dot145"><div class = "d1"></div></div> <div class="dot146"><div class = "d1"></div></div> <div class="dot147"><div class = "d1"></div></div> <div class="dot148"><div class = "d1"></div></div> <div class="dot149"><div class = "d1"></div></div> <div class="dot150"><div class = "d1"></div></div> <div class="dot151"><div class = "d1"></div></div> <div class="dot152"><div class = "d1"></div></div> <div class="dot153"><div class = "d1"></div></div> <div class="dot154"><div class = "d1"></div></div> <div class="dot155"><div class = "d1"></div></div> <div class="dot156"><div class = "d1"></div></div> <div class="dot157"><div class = "d1"></div></div> <div class="dot158"><div class = "d1"></div></div> <div class="dot159"><div class = "d1"></div></div> <div class="dot160"><div class = "d1"></div></div> <div class="dot161"><div class = "d1"></div></div> <div class="dot162"><div class = "d1"></div></div> <div class="dot163"><div class = "d1"></div></div> <div class="dot164"><div class = "d1"></div></div> <div class="dot165"><div class = "d1"></div></div> <div class="dot166"><div class = "d1"></div></div> </div> <div class = "footer"> Created by Brooke Simmerman </div></div></div> </body></html> Ignore the dots, they are just decoration. Like I said before, this works for the most part, except when it says to translate "gato", I enter "cat" and it logs "incorrect". Also I do not know how to generate a new random number each time the function runs. Thank you for taking time to help.
  9. Thanks, I figured out how to do the function, but if I do it multiple times it doesn't change, unless I tweak the code. If I click the spanish button, it says "Translate: gato". Afterwards I click it again and it still says, "Translate: gato". I will then tweak the code, such as change some styling and it will change to a different element. I want the element to change everytime I click the button, how do I do this? Here is my code: var spanishWords = ['gato', 'perro', 'hola', 'hamburguesa'];var englishWords = ['cat', 'dog', 'hello', 'hamburger'];//Random Generate Functionvar rgs = spanishWords[Math.floor(Math.random() * spanishWords.length)];var rge = englishWords[Math.floor(Math.random() * spanishWords.length)];// Prompt the user for a wordfunction spanishWord(){ var word = prompt("Translate: " + rgs);}function englishWord(){ var word = prompt("Translate: " + rge); translate(word)} Also, how do I make it so that if I answer this prompt, "Translate: gato" with "cat", then the word "correct" will display on another div.
  10. That helps, but I am stil lnot quite sure how to make the function. Maybe just an outline specific to this scenario would be helpful?
  11. Hey, so I have another question about how to write a function. What I have is a prompt, that asks, what does "..." mean? What I want is a function that randomly chooses a word from a dictionary to enter in the quotation marks. Here is my dictionary: var translation = {};// Spanish dictionarytranslation.spanish = {};translation.spanish["gato"] = "cat";translation.spanish["perro"] = "dog";translation.spanish["hola"] = "hello";// English dictionarytranslation.english = {};translation.english["cat"] = "gato";translation.english["dog"] = "perro";translation.english["hello"] = "hola"; There are two buttons. When I press the spanish button I want a spanish word to go in the quotes, and I would respond with the word translated in english. When I press the english button I want an english word to go in the quotes, and I would respond with the word translated in spanish. I would use this to review spanish vocab. How would I make a function that randomly chooses a word to go in the quotes. I know I would have to use math.random, but otherewise I do not know how to set it up. Please provide suggestions and ideas, thanks!
  12. Here is my code: <!DOCTYPE html><html lang="en"><head> <link rel='stylesheet' href='style.css'/><meta charset="utf-8"/><title>title</title><style></style><script>window.onerror = function(a, b, c, d){alert('Javascript Error:n'+a+'nURL: '+b+'nLine: '+c+' Column: '+d);return true;}</script><script>'use strict';window.onload = init;function init() {var str = "<h3>Available Products:</h3>";for (var key in products){str += products[key].name +" $"+ products[key].price +"<br/>";}document.getElementById("products").innerHTML = str;}function add(item){cart.push(products[item]);var str = "<h3>Items in your cart:</h3>";for (var key in cart){ str += cart[key].name +" $"+ cart[key].price +"<br/>";}document.getElementById("cart").innerHTML = str;console.log(products[item]);};function item(name,price){ this.name = name; this.price = price;};function add(item){var sum = 0;cart.push(products[item]);var str = "<h3>Items in your cart:</h3>";for (var key in cart){ str += cart[key].name +" $"+ cart[key].price +"<br/>"; sum += Number(cart[key].price);} str += '<br/><b>Total = $' + sum.toFixed(2) +'</b>';document.getElementById("cart").innerHTML = str;console.log(products[item]);}var products = [];products["milk"] = new item("Milk",2.89)products["eggs"] = new item("Eggs",1.72)products["candybar"] = new item("Candy bar",0.87)products["soda"] = new item("Soda",1.99)products["water"] = new item("Water",1.29)products["cereal"] = new item("Cereal",1.87)products["donut"] = new item("Donut",1.09)products["chips"] = new item("Chips",1.99)products["magazine"] = new item("Magazine",2.79)products["nwspaper"] = new item("Newspaper",0.99)products["bagel"] = new item("Bagel",0.99)products["fruit"] = new item("Fruit",1.99)products["cgrtts"] = new item("Cigarettes",5.99)products["batteries"] = new item("Batteries",3.99)var cart = [];function buyItem() { var buy = prompt("What item do you want to buy?").toLowerCase(); switch(buy){ case 'milk':add("milk");break; case 'eggs':add("eggs");break; case 'candy bar':add("candybar");break; case 'soda':add("soda");break; case 'water':add("water");break; case 'cereal':add("cereal");break; case 'donut':add("donut");break; case 'chips':add("chips");break; case 'magazine':add("magazine");break; case 'newspaper':add("nwspaper");break; case 'bagel':add("bagel");break; case 'fruit':add("fruit");break; case 'cigarettes':add("cgrtts");break; case 'batteries':add("batteries");break; default: alert("We do not sell that item!"); console.log("We do not sell that item!"); }}</script></head><body><div class="header"> <h3 style="font-family: corsiva; font-size: 25; color: indigo;">Cash Register<h3></div><div class="left"> <button style="font-family: corsiva; font-size:22; border:2px solid black; border-radius: 100%;" onclick="buyItem()"><strong>What item do you want to buy?</strong></button><div class="right"> <div id="products"> </div> <div id="cart"> </div></div><div class="footer"> <h5>Brooke Simmerman</h5></div></body></html> What I would like is for the list of products to appear in two columns so that I have space for more items. With what I have now, some of the items continue vertically into the footer div. I would rather they continue in another column next to the first. How do I do this?
  13. Oh, ok, do you know what language can do this? I would love to learn about it then come back to this project.
  14. Hey, so I just finished the basics of a simple program I have made to translate some Spanish vocab. After completing all the functions, I realized how long it would take to create a complete dictionary containing all the vocab that I learn in Spanish class. I would have to enter everything in both a spanish and an english dictionary. What I would like to do is create a button that when clicked comes up with a prompt.This would be the easy part, that I know how to do. The hard part is this: I want a function that enters whatever I type into the prompt as a word in the dictionary. Here is how my dictionaries are set up: var translation = {};// Spanish dictionarytranslation.spanish = {};translation.spanish["gato"] = "cat";translation.spanish["perro"] = "dog";translation.spanish["hola"] = "hello";// English dictionarytranslation.english = {};translation.english["cat"] = "gato";translation.english["dog"] = "perro";translation.english["hello"] = "hola"; The button looks like this: <button class = "NewWord"onclick="newWord()"> Add to Dictionary </button> This is the prompt: function newWord(){ var word = prompt("Add a new word to the dictionary.");} I thought it would be cool if I could click the button, and in the prompt I could type, "libro, book" and in the spanish dictionary it would enter a word that looked like this: translation.spanish["libro"] = "book";.Also, in the english dictionary a new word would enter and it would look like this:translation.english["book"] = "libro"; I was wondering, is there any way that this would work? If I could get a few ideas on how to do this that would be great. Like I have said before, I am a newbie, so this is all kind of a learning experience. If I could get some help that would be great. Thanks so much!
  15. I have one more question. I added some more words, but now the wrong translation comes up. Here is my new javascript: function word(spanish,english){ this.spanish = spanish; this.english = english;};function translate(word){ for (var key in translation){ var str = translation[key].spanish +" ~ " + translation[key].english; } document.getElementById("translation").innerHTML = str;}var translation = [];translation["gato"] = new word("gato","cat")translation["perro"] = new word("perro","dog")translation["hola"] = new word("hola","hello")function spanishWord(){var spanish = prompt("Type in Spanish word to receive the translation."); switch (spanish){ case 'gato':translate("gato");break; case 'perro':translate("perro");break; case 'hola':translate("hola");break; default: console.log("I do not know that word."); }}function englishWord(){var spanish = prompt("Type in English word to receive the translation."); switch (english){ case "cat": console.log(gato); break; default: console.log("I do not know that word."); }} As you can see I added more words, and more cases. The problem is, when I type in "gato" in response to the promt, "hola~hello" shows up. Do you know why this might be happening?
  16. Thanks so much! This worked. I can't believe I missed that.
  17. Sorry, I guess I don't know how to make the code easier to read. I thought it was three backslash thingys?? If someone could fix that or tell me how to that would be great for future use. Thanks.
  18. Please help, I am not exactly sure on how to make this work. I have created two buttons. On one you type in a spanish word to recieve that translation. The translation should appear like this: gato~cat, or something similar to this. I have begun working on the spanish button, but I do not know how to continue. The translation does not show up. Please help. Thanks so much!!! Here is the html: <!DOCTYPE html><html><head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script></head><body><div class = "border"><div class = "border2"> <div class = "header"> <h3>Espanol Dictionary</h3> </div> <div class = "search"> <button class = "spanish" onclick="spanishWord()"> Spanish </button> <button class = "english"onclick="englishWord()"> English </button> </div> <div class = "body"> <div class = "dot1"><div class = "d1"></div></div> <div class = "dot2"><div class = "d1"></div></div> <div class = "dot3"><div class = "d1"></div></div> <div class = "dot4"><div class = "d1"></div></div> <div class = "dot5"><div class = "d1"></div></div> <div class = "dot6"><div class = "d1"></div></div> <div class = "dot7"><div class = "d1"></div></div> <div class = "dot8"><div class = "d1"></div></div> <div class = "dot9"><div class = "d1"></div></div> <div class = "dot10"><div class = "d1"></div></div> <div class = "dot11"><div class = "d1"></div></div> <div class = "dot12"><div class = "d1"></div></div> <div class = "dot13"><div class = "d1"></div></div> <div class = "dot14"><div class = "d1"></div></div> <div class = "dot15"><div class = "d1"></div></div> <div class = "dot16"><div class = "d1"></div></div> <div class = "dot17"><div class = "d1"></div></div> <div class = "dot18"><div class = "d1"></div></div> <div class = "dot19"><div class = "d1"></div></div> <div class = "dot20"><div class = "d1"></div></div> <div class = "dot21"><div class = "d1"></div></div> <div class = "dot22"><div class = "d1"></div></div> <div class = "dot23"><div class = "d1"></div></div> <div class = "dot24"><div class = "d1"></div></div> <div class = "dot25"><div class = "d1"></div></div> <div class = "dot26"><div class = "d1"></div></div> <div class = "dot27"><div class = "d1"></div></div> <div class = "dot28"><div class = "d1"></div></div> <div class = "dot29"><div class = "d1"></div></div> <div class = "dot30"><div class = "d1"></div></div> <div class = "dot31"><div class = "d1"></div></div> <div class = "dot32"><div class = "d1"></div></div> <div class = "dot33"><div class = "d1"></div></div> <div class = "dot34"><div class = "d1"></div></div> <div class = "dot35"><div class = "d1"></div></div> <div id = "translation"></div> <div class = "dot101"><div class = "d1"></div></div> <div class = "dot102"><div class = "d1"></div></div> <div class = "dot103"><div class = "d1"></div></div> <div class = "dot104"><div class = "d1"></div></div> <div class = "dot105"><div class = "d1"></div></div> <div class = "dot106"><div class = "d1"></div></div> <div class = "dot107"><div class = "d1"></div></div> <div class = "dot108"><div class = "d1"></div></div> <div class = "dot109"><div class = "d1"></div></div> <div class = "dot110"><div class = "d1"></div></div> <div class = "dot111"><div class = "d1"></div></div> <div class = "dot112"><div class = "d1"></div></div> <div class = "dot113"><div class = "d1"></div></div> <div class = "dot114"><div class = "d1"></div></div> <div class = "dot115"><div class = "d1"></div></div> <div class = "dot116"><div class = "d1"></div></div> <div class = "dot117"><div class = "d1"></div></div> <div class = "dot118"><div class = "d1"></div></div> <div class = "dot119"><div class = "d1"></div></div> <div class = "dot120"><div class = "d1"></div></div> <div class = "dot121"><div class = "d1"></div></div> <div class = "dot122"><div class = "d1"></div></div> <div class = "dot123"><div class = "d1"></div></div> <div class = "dot124"><div class = "d1"></div></div> <div class = "dot125"><div class = "d1"></div></div> <div class = "dot126"><div class = "d1"></div></div> <div class = "dot127"><div class = "d1"></div></div> <div class = "dot128"><div class = "d1"></div></div> <div class = "dot129"><div class = "d1"></div></div> <div class = "dot130"><div class = "d1"></div></div> <div class = "dot131"><div class = "d1"></div></div> <div class = "dot132"><div class = "d1"></div></div> <div class = "dot133"><div class = "d1"></div></div> <div class = "dot134"><div class = "d1"></div></div> <div class = "dot135"><div class = "d1"></div></div> </div> <div class = "previousSearches"> </div> <div class = "footer"> </div></div></div> </body></html> I don't think the css is necessary. Here is the javascript: function word(spanish,english){ this.spanish = spanish; this.english = english;};function translate(word){ for (var key in translation){ translation[key].spanish + translation[key].english; } document.getElementById("translation").innerHTML = str;}var translation = [];translation["gato"] = new word("gato","cat")function spanishWord(){var spanish = prompt("Type in Spanish word to receive the translation."); switch (spanish){ case 'gato':translate("gato");break; default: console.log("I do not know that word."); }}function englishWord(){var spanish = prompt("Type in English word to receive the translation."); switch (english){ case "cat": console.log(gato); break; default: console.log("I do not know that word."); }} As you can see I have only created one word and one outcome. I will expand a lot once I have all the function and everything sorted out. Please help so that the translation appears on the screen! Note: I am still kind of a newbie, and don't know much yet. I would appreciate anybody's help. Thanks!!
  19. Never mind, I figured out the style sheet thing, it was just a small brain ######. Although I do still have a question about how to make a function that adds up the total of the items in the cart.
  20. Also, how do I make a function that adds all the prices from the cart?
  21. Thank you for the help! What you have showed me brings me to one new question. When I used this code the styling disappeared. The divs no longer look like a real website. Here is the code: <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"/><title>title</title><style></style><script>window.onerror = function(a, b, c, d){alert('Javascript Error:n'+a+'nURL: '+b+'nLine: '+c+' Column: '+d);return true;}</script><script>'use strict';window.onload = init;function init() {var str = "<h3>Available Products:</h3>";for (var key in products){str += products[key].name +" $"+ products[key].price +"<br/>";}document.getElementById("products").innerHTML = str;}function add(item){cart.push(products[item]);var str = "<h3>Items in your cart:</h3>";for (var key in cart){ str += cart[key].name +" $"+ cart[key].price +"<br/>";} document.getElementById("cart").innerHTML = str;console.log(products[item]);};function item(name,price){ this.name = name; this.price = price;};var products = [];products["milk"] = new item("milk",2.89)products["eggs"] = new item("eggs",1.72)products["candybar"] = new item("candy bar",0.87)products["soda"] = new item("soda",1.99)products["water"] = new item("water",1.29)products["cereal"] = new item("cereal",1.87)products["donut"] = new item("donut",1.09)products["chips"] = new item("chips",1.99)products["magazine"] = new item("magazine",2.79)products["nwspaper"] = new item("newspaper",0.99)products["bagel"] = new item("bagel",0.99)products["fruit"] = new item("fruit",1.99)products["cgrtts"] = new item("cigarettes",5.99)var cart = [];function buyItem() { var buy = prompt("What item do you want to buy?").toLowerCase(); switch(buy){ case 'milk':add("milk");break; case 'eggs':add("eggs");break; case 'candy bar':add("candybar");break; case 'soda':add("soda");break; case 'water':add("water");break; case 'cereal':add("cereal");break; case 'donut':add("donut");break; case 'chips':add("chips");break; case 'magazine':add("magazine");break; case 'newspaper':add("nwspaper");break; case 'bagel':add("bagel");break; case 'fruit':add("fruit");break; case 'cigarettes':add("cgrtts");break; default: alert("We do not sell that item!"); console.log("We do not sell that item!"); }}</script></head><body><div class="header"></div><div class="left"> <div id="products"> </div></div><div class="footer"></div><div class="right"><button style="font-family: corsiva; font-size:20; border:1px solid black; border-radius: 100%;" onclick="buyItem()">What item do you want to buy?</button><div id="cart"></div></div></body></html> Here is the stylesheet: .header { width: 734; height: 62px; background-color: crimson; border-radius: 10px; border: solid black 2px;}.left { width: 65; height: 323px; background-color: crimson; border-radius: 10px; border: solid black 2px; margin-top: -2}.right { width: 666; height: 323px; background-color: darksalmon; border-radius: 10px; margin-left: 67; margin-top: -391; border: solid black 2px;}.footer { width: 734; height: 62px; background-color: crimson; border-radius: 10px; border: solid black 2px; margin-top: -2}button { margin-left:230; margin-top:85; height:160; width:160; background-color:crimson;} Sorry for all the questions, but could you help me with how to style the divs? Thanks!
  22. I need help on this topic ASAP. Please help!

    1. JJ Siddeshwar

      JJ Siddeshwar

      You Mean "ASPX"

  23. I am new at coding, I only know some things about javascipt and html/css. Right now I am trying to create a simple cash register on codecademy. On javascript I have a prompt and when I type in "eggs" for example, it is supposed to console the price of eggs to the console, but nothing shows up. Here is my html code: <!DOCTYPE html><html><head> <link rel='stylesheet' href='style.css'/> <script src='script.js'></script></head><body> <div class="header"> </div> <div class="left"> </div> <div class="footer"> </div> <div class="right"> <button style="font-family: corsiva; font-size:20; border:1px solid black; border-radius: 100%;" onclick="buyItem()">What item do you want to buy?</button> </div></body></html> Here is my javascript: function add(){ console.log();};function item(name,price){ this.name = name; this.price = price;};var milk = new item("milk",2.89)var eggs = new item("eggs",172)var candybar = new item("candy bar",0.87)var soda = new item("soda",1.99)var water = new item("water",1.29)var cereal = new item("cereal",1.87)var donut = new item("donut",1.09)var chips = new item("chips",1.99)var magazine = new item("magazine",2.79)var nwspaper = new item("newspaper",0.99)var bagel = new item("bagel",0.99)var fruit = new item("fruit",1.99)var cgrtts = new item("cigarettes",5.99)function buyItem() { var buy = prompt("What item do you want to buy?").toLowerCase(); switch(buy){ case 'milk': console.log(milk.price);break; case 'eggs': console.log(eggs.price);break; case 'candy bar':console.log(candybar.price);break; case 'soda':console.log(soda.price);break; case 'water':console.log(water.price);break; case 'cereal':console.log(cereal.price);break; case 'donut':console.log(donut.price);break; case 'chips':console.log(chips.price);break; case 'magazine':console.log(magazine.price);break; case 'newspaper':console.log(nwspaper.price);break; case 'bagel':console.log(bagel.price);break; case 'fruit':console.log(fruit.price);break; case 'cigarettes':console.log(cgrtts.price);break; default: console.log("We do not sell that item!"); }} Can you tell me what is wrong with my code? Here are my two questions: 1. How do I console the price of an item to the log? 2. How do I direct what I want to console to a certain div? 3. Is there anything messed up with my code? Thank you so much for helping! P.S. Don't make fun of me I am not that good yet P.S. P.S. I also have a stylesheet but didn't think it was necessary to mention.
×
×
  • Create New...