un peu plus d'aide pour Eratosthene
This commit is contained in:
40
R4.01_R4.A.10/td_tp/tp1/src/eratosthene/eratosthene.html
Normal file
40
R4.01_R4.A.10/td_tp/tp1/src/eratosthene/eratosthene.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"
|
||||
>
|
||||
<script src="eratosthene.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
||||
<form role="search">
|
||||
<input name="limit" type="text">
|
||||
<input type="submit" value="compute">
|
||||
</form>
|
||||
<article>
|
||||
<p>time : <span id="time1"></span></p>
|
||||
<p>time : <span id="time2"></span></p>
|
||||
<p id="primes"></p>
|
||||
</article>
|
||||
</main>
|
||||
<script>
|
||||
document.querySelector("form").addEventListener("submit",ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
let start,end;
|
||||
|
||||
start = performance.now();
|
||||
primes = eratosthene1(ev.target.limit.value);
|
||||
end = performance.now();
|
||||
|
||||
document.getElementById("time1").textContent = end - start;
|
||||
document.getElementById("primes").textContent = primes;
|
||||
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user