HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
If the stylesheet you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="author" content="John Doe">
<title>Utilitaire optimisation HYIP</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css">
</head>
<!-- Si vous avez des suggestions ou des corrections de bug ou même des idées d'outils à développer,
n'hésitez pas à me contacter:
Facebook: https://www.facebook.com/tim.lerocher.9
Maniabook: https://maniabook.argentmania.com/user/Timothy -->
<body>
<div class="container">
<br><br>
<p>
Ce utilitaire permet de calculer la meilleure stratégie pour obtenir un rendement maximal sur un plan
d'investissement. <br><br>
Entrez votre capital de départ, le pourcentage d'intérêt journalier et la durée de l'investissement.<br><br>
Le tableau des résultats vous indique jusqu'a quel jour vous devriez réinvestir vos gains avant de commencer à
les retirer afin de maximiser le bénéfice total sur la durée prévue.
<br><br>
</p>
<div class=row>
<div class="col-3">
<form action="/action_page.php">
<div class="form-group">
<label for="capital">Capital de départ:</label>
<input type="number" class="form-control" id="capital">
</div>
<div class="form-group">
<label for="interest">Intérets journaliers:</label>
<input type="number" class="form-control" id="interest" step="0.01">
</div>
<div class="form-group">
<label for="duration">Durée globale estimée:</label>
<input type="number" class="form-control" id="duration">
</div>
<button type="submit" class="btn btn-primary">Calculer</button>
</form>
</div>
<div class="col-9" id="div-results" style="display: none">
<p id="results"></p>
<table class="table">
<thead>
<tr>
<th scope="col">Jour du premier retrait</th>
<th scope="col">Capital final</th>
<th scope="col">Nb de retraits</th>
<th scope="col">Montant retrait quotidien</th>
<th scope="col">Bénéfice total</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
</body>
</html>
// Si vous avez des suggestions ou des corrections de bug ou même des idées d'outils à développer,
// n'hésitez pas à me contacter:
// Facebook: https://www.facebook.com/tim.lerocher.9
// Maniabook: https://maniabook.argentmania.com/user/Timothy
var table;
$(document).ready(function () {
table = $('table').DataTable({
"paging": false,
"info": false,
"searching": false
});
$('input').on('input', function (e) {
table
.clear()
.draw();
})
$('form').submit(function (e) {
e.preventDefault();
let capital = parseInt($('#capital').val());
let interestTx = parseFloat($('#interest').val());
let duration = parseInt($('#duration').val());
var results = calc(capital, interestTx, duration)
for (var result of results) {
table.row.add(result).draw(false);
}
table
.order([4, 'desc'])
.draw();
let html = "Voici les résultats pour un investissement de " + capital + "$ avec un taux d'intérêts journaliers de " + interestTx + "%/jour pour une durée de " + duration + " jours"
$('#results').html(html);
$('#div-results').css('display', 'inline')
});
});
const calc = function (capital, interestTx, duree) {
let results = [];
let t, capitalTmp, benef, dailyInterest;
for (var i = 1; i <= duree; i++) {
capitalTmp = capital;
for (var j = 0; j < i; j++) {
capitalTmp += capitalTmp * interestTx / 100;
}
dailyInterest = capitalTmp * interestTx / 100
benef = (duree - i) * dailyInterest;
results.push([
i,
capitalTmp.toFixed(2) + "$",
Math.round(duree - i),
dailyInterest.toFixed(2) + "$",
benef.toFixed(2) + "$",
])
}
return results;
}
Also see: Tab Triggers