A
A
Artyom Arutyunyann2020-03-29 18:46:21
Network administration
Artyom Arutyunyann, 2020-03-29 18:46:21

How to add to onclick?

Hello, I have a question, how to add a number to "onclick", here is the code for you:

let filed = document.createElement('div');
document.body.appendChild(filed);
filed.classList.add('gBody');

for(let i = 0; i < 1800; i++){
  let block = document.createElement('div');
  filed.appendChild(block);
  block.classList.add('blocks');
}

How to add a number of type to onclick whether there is something like. thank.
block.onclick = 'block' + i;

Answer the question

In order to leave comments, you need to log in

9 answer(s)
C
CityCat4, 2019-09-13
@FLOYREN

Something recently there have been a lot of questions on this topic ...
Well, once again, as a person who has been keeping a real server server at home for more than a year (and not a workstation that works as a server), I will express my opinion.
Installing a server at home is about the same as buying a car - if you work as an administrator (driver) - then it will not be difficult for you to solve all issues related to the server (car) - because this is part of your job and they have been with you for a long time and resolved many times :) If you are not an admin (driver), but only used hosting (riding a taxi), then suddenly a hundred thousand questions will pop up that need to be addressed (yes, they will pop up anyway, but the fact is that a professional the administrator (driver) has long known how to solve them quickly and efficiently).
Starting a server at home is a natural decision for an admin and it’s somehow even stupid to discuss it, especially if you work at home, if you constantly set up experiments, if you need a virtualization environment ... True, the only (but extremely significant) plus is the fact that you are completely you know exactly where your data is and you can secure it in all attractive ways. Your mail. Your site. Your documents, photos, videos. Given the current paranoia, a huge plus.
Unfortunately, there are no pluses without minuses :) I would also like to know more about them - not to dissuade, but to warn.
- Price, complex, spare parts. New server hardware is very expensive. A server for half a lemon is like hello. "For themselves" usually take boo iron. This is a fairly common method, so there are special offices that sell used server hardware. How old is it? Usually less than five years old. Why five? In large offices, there are regulations according to which iron is written off after a certain period, usually it is five years. It is written off, regardless of the condition, even if it is perfect. You can buy a server for quite reasonable money (of course, keeping in mind that you need to take new screws and not desktop ones, but raid ones). Komplektuhu and spare parts can be bought in the same offices.
- Accommodation. The server is usually in a server chassis that is placed in a rack. It's good if you have a rack :) otherwise you need to attach it somewhere - and without a rack this big flat thing will be very inconvenient for moving (Life hack: I have it on the closet)
- Noise. such a concept as
does not exist. From the word at all. Because the closet is for a server room. Even the quietest server (and I selected it precisely for "quietness") even at the lowest cooler speeds (in BIOS - 4500 rpm) makes quite noticeable noise. In addition, if the temperature rises, the server automatically puts on the BIOS settings and increases the speed of rotation of the coolers - as a result, my server at any time steadily buzzes quietly and periodically howls - because it overheats.
- Comfortable temperature. For the server and the person - it is different and therefore it will easily turn out that you will have to allocate a separate room to the server :D
- Electricity. The server is eating electricity. Round the clock, like a sentinel in a booth. Get ready for higher utility bills. In addition, a server without ups will crash during drawdowns - and they are not uncommon in houses. (I don't have an oops either :( )
- Wear parts. It was already said about spare parts and accessories - so, don't forget that the server contains parts that break :) Coolers, screws - you will need to buy all this :)
- Internet channel. For physicists, as a rule, they don’t provide a flat-rate (well, they’ll break it, like with a yuri), so you won’t be able to keep a loaded site there - it will slow down like hell. Although a regular site will work (if the wire gives white IPs).
- Anti-virus, anti-ddos, anti-spam, anti-everything. You will have to do all this yourself or just score. Of course, it is not difficult for a professional administrator to do this.
- Setting, backup. In fact, a repetition of the previous paragraph - to shove it on someone, yourself, everyone yourself ...
- It is almost impossible to change the IP, not to mention its regular change.

R
Ronald McDonald, 2019-09-13
@Zoominger

It is possible, if the services are for themselves and non-critical, otherwise Mikhail Lyalin painted correctly.
The noise from them is loud, if we are talking about real servers.
You can buy a powerful pitch and use it as a server, but this is all a collective farm.
You can buy a server and rent a shelf in the data center - this is generally ideal and will solve reliability problems.
Or you can even rent a server.

M
Mikhail Lyalin, 2019-09-13
@mr_jok

overheating, noise, unreliable power supply, unreliable Internet channel = everything is against

L
lossyy, 2019-09-15
@lossyy

So my answer, although late, but has the right to life)
Buy used. model specifically hp ml 370 g6 - and there will be happiness. You can even work with him easily. So - you can place it somewhere in the pantry and it will be good.
1. It heats up slightly.
2. He is self-sufficient, the most difficult thing will be to drag 50 kg to his floor.
3. It has 2 power supplies, a lot of coolers, 2 processors, a lot of slots for RAM, a basket for 2.5 disks for 8 pieces, 2 networks of 1 gigabit each, an honest raid, + a lot of performance for expansion, this is really travel crap. Well, you don't have to buy a closet. Closet in itself.

D
DdarkX, 2019-09-19
@Sheffield

On average, it's easy. I have a mother from gigabit, two network and I3 percent. Soft raid and one disk for myself, there are a lot of interesting things. One network loads 4 sites, a cloud, one postgres base for bukhs, the second network looks into the locale dlna, samba and any home. All this porridge has been brewing for 4 years now, there are no problems, but oops is needed, otherwise the neighbor with welding is terrible in the basement

S
Sanes, 2019-09-13
@Sanes

If you have nothing to do, then collect. Suitable for personal use only.
You can’t write PTR, your provider can fuck you for mail.

P
Puma Thailand, 2019-09-13
@opium

Contain

S
Sergey Sokolov, 2020-03-29
@Casper335

Something like this is possible:

for(let i = 0; i < 18; i++){
  let block = document.createElement('div');
  field.appendChild(block);
  block.classList.add('blocks');
  block.addEventListener('click', event => onClick(event, i));
}


fiddle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question