Answer the question
In order to leave comments, you need to log in
How to make a script that subtracts the amount as a percentage?
I want to make discounts on my site.
And I need a small JS or JQ script that would take the value (sum/number) from the block with id = "summa" and subtract the amount I specified from it as a percentage.
Answer the question
In order to leave comments, you need to log in
You must not have more than one same id on a page, id is the element's unique id. Use the class attribute to indicate blocks with a sum. Code example:
<div class="summa">400</div>
<div class="summa">500</div>
<div class="summa">600</div>
<div class="summa">700</div>
$(function() {
let percent = 20; // Скидка в процентах
$('.summa').each((key, val) => {
$(val).text($(val).text() - $(val).text() * percent * 0.01);
});
});
A little clumsy variation on forms, without checking for possible errors
https://jsfiddle.net/8ok30u7k/33/
Proxmox is an ecosystem for using KVM and OpenVZ. Xen requires modification of the guest OS kernel, OpenVZ containers are poorly isolated (but minimal overhead), VmWare can’t do everything (but there are useful / convenient goodies), I love KVM for integration with qemu (you can implement virtual ARM on SPARC without modifying the distribution kit Run the OS on the guest).
What kind of hosting do you want? In the form of a ready-made virtual machine, for example? So for this it does not matter on the basis of what it is done. If in the form of some kind of resource pool, within which you will independently manage the number and characteristics of VMs, then the question is different: what funds do you have for this? Because you can offer from a variety of price segments. If the question is how to organize a platform, the capacities from which you will sell to customers, then my opinion, despite the fact that I work closely with vmware, is this: you need to look towards open source, at least until hosting remains "comparatively small". VMware has very expensive solutions, and this is their main disadvantage. And a very fat minus.
And why don't you look at ready-made answers to your question, here for example - habrahabr.ru/qa/39597/
1) Do you plan to provide only Linux to customers?
If so, then OpenVZ is optimal, because has a minimal overhead: habrahabr.ru/post/177423/
If clients need other operating systems, or Linux with its own kernel, modules and hardware emulation, then OpenVZ is not suitable.
2) Billing already selected? If yes, then see what products it can integrate with.
3) Migration of virtual machines, fault-tolerant data storage, etc. do you plan to do?
If so, then pure KVM or OpenVZ is hardly suitable, because. would require too much manual configuration.
Look towards Proxmox or OpenNebula: www.linux.org.ru/news/opensource/9195848
(a lot of ENT sracha, but there is something useful).
Have a look at hostbillapp.com/features/apps/proxmox.html , might it work?
Try OpenVZ 7, a new version of the popular virtualization system for hosting.
OpenVZ 7 has both virtual machines and containers, the installation is simple, there are many features in the opensource version. If you grow, you can switch to Virtuozzo 7 and get technical support.
PS Hosters don't choose OpenVZ for pretty eyes. View statistics by virtualization type on LowEndBox or ServerBear.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question