Jump to content

davej

Moderator
  • Posts

    3,988
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by davej

  1. One the server side you have session variables or a database. On the client side you have local storage... https://www.w3schools.com/html/html5_webstorage.asp For a typical quiz you will want to put the scoring and storage of final results on the server side.
  2. Obviously you can post questions here. You might also check MeetUp.com for local developer groups.
  3. I have been playing with something like that. I am thinking that ip addresses and usernames can be added to a timeout table. Each session can also have an "ignore" flag. Each new session gets looked up to see if the username or ip-address is in the timeout table. If it is found in the table then the "ignore" flag is set.
  4. Try experimenting with this and you will see the problem... window.onclick = function(e) { if (!e.target.matches('.dropbtn')) { alert('try to remove show from myDropdown'); var myDropdown = document.getElementById("myDropdown"); if (myDropdown.classList.contains('show')) { myDropdown.classList.remove('show'); } }else{ alert('ignore'); } }
  5. Why do you think your anchor tag needs the same id as something else?
  6. What type of server or what type of hosting are you talking about?
  7. There is always the simple nbsp character, but if you have no understanding of CSS then you should learn how to use that.
  8. The only consideration that the loop introduces is the need for a styling approach that will accept a varying number of these div blocks.
  9. This works in Php, but most programmers use various languages. For example in Javascript this same approach fails... <script> arrtest['letter1'] = 'a'; arrtest['letter2'] = 'b'; alert(arrtest['letter1']); </script>
  10. Initializing variables can prevent a program from crashing unexpectedly. Isn't that a good enough reason? Also Php is very, very forgiving (also known as "idiot-proof"). Why learn bad habits that are poor programming in other languages? Try your code in Javascript and you will see that it fails. In Javascript (and almost all languages) an array must be declared before use.
  11. .form-actions {width:200px; margin-left:auto; margin-right:auto; text-align:center;}
  12. Review available Php security suggestions such as... https://www.owasp.org/index.php/PHP_Security_Cheat_Sheet
  13. Most Javascript experts advise the total avoidance of eval(). In fact classic Javascript has so much baggage that books have been written just to tell you what features you should avoid using. http://archive.oreilly.com/pub/a/javascript/excerpts/javascript-good-parts/bad-parts.html
  14. Is this your code or just some code example that you copied from somewhere? I would suggest that you begin with a simpler example of using local storage. https://www.w3schools.com/html/html5_webstorage.asp
  15. Inheritance in most languages is when you have a Person class and also an Employee class. You can then have Employee inherit Person since every employee is also a person. Classic Javascript has a prototype scheme that is rather strange. You can google "Javascript inheritance" to find various discussions of both the classic Javascript and the new es6/es2015 approaches.
  16. For a responsive menu the normal need is for a vertical stacked menu such as... https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_topnav
  17. I don't see any inheritance in your code. And why would you want to delete a property anyway? myMother is a Person. That isn't inheritance. If you are learning Javascript as a newbie I would not worry about this topic yet, because it is a rather sticky issue, and Javascript is in the middle of an upgrade (es6) to a more standard way of handling inheritance.
  18. Yes, as John-Jack suggests you can learn to use AJAX, or you can redirect to a URL from Javascript similar to what you are doing now. It depends on whether you want to reload the page or not. I tend to use hidden forms for this sort of thing, but your GET approach is perfectly fine. See... https://www.w3schools.com/jsref/met_loc_assign.asp
  19. I'm glad I'm not working on the "bleeding edge" of things. All you can do is read the available MDN documentation and try different options.
  20. It's not exactly clear what you are asking but you could use some javascript with a confirm popup. The javascript would set values in a URL or hidden form and then submit it. https://www.w3schools.com/jsref/met_win_confirm.asp
  21. Your question is too vague. A "menu slide" could mean many different things.
  22. It looks like the restoration may still be in progress.
  23. Have you tried the W3C validator? https://jigsaw.w3.org/css-validator/
  24. Here is a demonstration of the Netbeans debugger. See... https://www.youtube.com/watch?v=2Z9B8wYhKWw
  25. There are almost always several different ways to approach any programming problem, and that is true here, but you first need to logically understand what you are trying to accomplish, and usually you also want to think of a few simple "test cases" to help you verify your thinking and your code. Your above question makes me wonder if you logically understand what the code needs to do? How would you write code to detect that at least one square on the board is empty? You can use pencil and paper to help you reason through the problem. My code sample uses a global "turn" variable but you could also test the values on the gameboard. How would you do that? Also what are you using to write this code? Eclipse? Netbeans? Whatever it is you should learn to use the debugger so that you can single-step through your code. I would also suggest that you sign up here... https://www.hackerrank.com/ ...and try working the introductory Java practice problems.
×
×
  • Create New...