davej

Moderator
  • Content count

    3,922
  • Joined

  • Last visited

  • Days Won

    84

davej last won the day on March 23

davej had the most liked content!

Community Reputation

239 Excellent

2 Followers

About davej

  • Rank
    davej
  • Birthday July 15

Contact Methods

  • MSN
    e-mail: davejonline@hotmail.com

Profile Information

  • Gender
  • Location
    STL
  • Interests
    Learning web development.

Recent Profile Visitors

62,068 profile views
  1. Ingolme just discussed this topic in a Php thread. You would use the same Javascript but direct it to your servlet url. AJAX_PHP
  2. As the last item at the bottom of the body add your code or; <script>document.write('<br>'+document.URL);</script>
  3. Yeah, it seems odd that the multi-page requirement isn't listed above, but the OP made it clear that it was also one of the requirements. Several of the bullet items seem rather vague to me. What sort of array of options? What is an "engaging interaction?"
  4. He told us this was a school assignment, so I don't want to simply post a solution. He also told us it must consist of multiple pages with one question per page. His instructor told him to use only HTML, CSS and Javascript. His Javascript code is filled with errors and does not display an understanding of what needs to be done. We told him to look at Local Storage several times.
  5. Okay, if there is only one question per page then why do you need a submit button? The way you had it before you edited it was fine. If you only have one question per page then why does your code need a loop? Your else-if's are wrong and you are confusing = and ==. If indeed you have only one question per page then you simply have the buttons store the answer and then jump to the next page. Only the final page will do any calculations. I guess you can have a submit button if you want it, but that adds complexity because then you would probably want to change the style of the selected button. If you immediately jump to the next page then you don't need to consider styling that button.
  6. So then again I will tell you to go look at... https://www.w3schools.com/html/html5_webstorage.asp If this is a "beginner level" class then the instructor is being silly and unrealistic.
  7. What are the prerequisites for this class? What languages does s/he expect you to use?
  8. Try... <script> 'use strict'; function init() { var buttons = document.getElementsByClassName('btn'); for(var i=0 ; i<buttons.length ; i++){ buttons[i].onclick = clkhandler; } } function clkhandler(evt){ var ans = evt.target.innerHTML; var ques = evt.target.parentNode.getElementsByClassName('text')[0].innerHTML; alert(ques + " = " + ans); } window.onload = init; </script>
  9. It sounds like you are talking about two different things. You could use a JSON string to dynamically create the form or you could read the submitted form and create a JSON string for AJAX, or you could do both. I don't think it would be efficient to use the same JSON structure to do both.
  10. 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.
  11. Obviously you can post questions here. You might also check MeetUp.com for local developer groups.
  12. 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.
  13. 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'); } }
  14. Why do you think your anchor tag needs the same id as something else?