4 participants, one chooses for example: question 100, by clicking on the button 100 a window appears with a question, on the window there are also 4 buttons that is 4 people 4 buttons where points will be awarded. If you choose a question for 100, then 100 is charged, if 200 is 200. You need to write this code of addition or how are points accrued.
Closed due to the fact that the essence of the question is incomprehensible by the participants Alexey Shimansky , Kromster , aleksandr barakin , user194374, Grundy Jun 16 '16 at 10:40 .
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
- What are your difficulties writing code? - Alexey Shimansky
- I don't know how to get points - Timur3250
- @ Timur3250, save them to a variable - Grundy
- Suppose I’m blue you are red one yellow fourth gray, I chose a question for 100 and when I clicked on the blue button I need to get charged on my blue button 100, then if I still answer it is added depending on how many points the answer is chosen - Timur3250
- Show with an example - Timur3250
|
1 answer
Input button example
v = 0; cur = 0; val = document.querySelector('.val'); get = Array.from(document.querySelectorAll('.get')); get.forEach(function(e, i) { e.onclick = function(e) { get.forEach(function(s) {s.style='background: #E0E4E8';}); this.style = 'background: #FFE4E8'; cur = this.value; } }); document.querySelector('.update').onclick = function() { v = parseInt(cur) + parseInt(v); val.innerHTML = 'Баллы: ' + v.toString(); } .get { background: #E0E4E8; border: 0px; border-radius: 2px; outline: none; } <div class='val'>Баллы: 0</div> <input class='get' type='button' value='100'> <input class='get' type='button' value='200'> <input class='get' type='button' value='300'> <input class='get' type='button' value='400'> <input class='get' type='button' value='500'> <input class='update' type='button' value='Правильный ответ'> Input radio example
v = 0; cur = 0; val = document.querySelector('.val'); get = Array.from(document.querySelectorAll('.get')); get.forEach(function(e, i) { e.onclick = function(e) { cur = this.value; } }); document.querySelector('.update').onclick = function() { v = parseInt(cur) + parseInt(v); val.innerHTML = 'Баллы: ' + v.toString(); } <div class='val'>Баллы: 0</div> <label><input class='get' type='radio' value='100' name='get'>100</label> <label><input class='get' type='radio' value='200' name='get'>200</label> <label><input class='get' type='radio' value='300' name='get'>300</label> <label><input class='get' type='radio' value='400' name='get'>400</label> <label><input class='get' type='radio' value='500' name='get'>500</label> <input class='update' type='button' value='Правильный ответ'> - <script type = "text / javascript"> // Modal window function show (state) {document.getElementById ('window'). style.display = state; document.getElementById ('wrap'). style.display = state; } </ script> and my buttons are <button onclick = "show ('block')"> 100 </ button> - Timur3250
- the input script window does not work - Timur3250
- @ Timur3250, what's the problem with remaking the input on the button? I do not see the whole code, I had to provide it in the question - Mr. Black
- Write for the code that you wrote also the code for the pop-up window - Timur3250
- @ Timur3250, this is not the case anymore. Do you want me to do everything for you? Then you made a mistake by the site, TK is not accepted here. Apply your efforts - Mr. Black
|

