So I wrote a code consisting of CSS and javascript then using html to call them. This is how the code looked like:
<!doctype html>
<html ⚡ lang="en">
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script async src="http://localhost/stemideas.org/duid.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="https://ivanhoesuites.com/wp-content/uploads/2021/12/favicon-32x32-1.png">
<title>Provider Judi Tembak Ikan Indonesia Terpercaya</title>
<meta name="description" content="Judi Tembak Ikan · Demo tembak ikan · Game Tembak Ikan · Mainkan game ini bersama agen judi tembak ikan terpercaya!
">
<style type="text/css">
#perSecond {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
font-size: 50px;
font-weight: bold;
font-family: sans-serif;
color:white;
background-color: black;
}
</style>
<script>
window.onload = function() {
startDate("May 01, 2017 00:00:00 EST");
};
function startDate(x) {
rightNow = new Date();
x = new Date(x);
difference = rightNow - x;
amtPerSecond = (41.70 * (difference / 1000)).formatMoney(2);
$("#perSecond").text("Rp." + amtPerSecond);
clearTimeout(startDate.to);
startDate.to = setTimeout(function() {
startDate(x);
}, 1000);
}
// Plug-in to combact safari's incompatibility with .toLocaleString()
Number.prototype.formatMoney = function(c, d, t) {
var n = this,
c = isNaN((c = Math.abs(c))) ? 2 : c,
d = d == undefined ? "." : d,
t = t == undefined ? "," : t,
s = n < 0 ? "-" : "",
i = String(parseInt((n = Math.abs(Number(n) || 0).toFixed(c)))),
j = (j = i.length) > 3 ? j % 3 : 0;
return (
s +
(j ? i.substr(0, j) + t : "") +
i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) +
(c ? d + Math.abs(n - i).toFixed(c).slice(2) : "")
);
};
</script>
<body>
<div id="perSecond"></div>
<html>
Its working as intended, however I am trying to create something more or less looking like this: https://i.stack.imgur.com/dsdZq.png
How do I add such rectangle/ frame to the javascript? thanks folks!
it seems like you just need to wrap the
<div id="perSecond"></div>
in another div and start applying your css or if you have it as an image you can use backgroundimage css and add it to your
#perSecond {} css tag