Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

167
Visualizações
Adding a rectangle/frame to cover a simple javascript number counter

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!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

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

Background Image

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda