html.cafe - a realtime HTML editor and host

Edit the html in the top panel, see the result here.
Save your page and get a link to view it live, anywhere. function login(){if(document.getElementById('mdp').value==='CESCA2026'){document.getElementById('login').style.display='none';document.getElementById('app').style.display='block';maj()}else{document.getElementById('err').style.display='block'}} function fmt(n){return Math.round(n||0).toLocaleString('fr-FR')} function r10(n){return Math.round(n/10)*10} function addMonths(d,m){let x=new Date(d);x.setMonth(x.getMonth()+m);return x} function fmtD(d){return d?d.toISOString().slice(0,10).split('-').reverse().join('/') : '-'} function onglet(i,btn){document.querySelectorAll('.doc').forEach((e,idx)=>e.classList.toggle('on',idx===i));document.querySelectorAll('.tabs button').forEach(b=>b.classList.remove('on'));btn.classList.add('on')} function maj(){ let g=id=>document.getElementById(id).value; let montant=Number(g('montant')||0), duree=Number(g('duree')||0), cep=Number(g('cep')||0), acs=Number(g('acs')||0), naf=Number(g('naf')||0), parts=Number(g('parts')||0); let frais=r10(montant*0.02), total=r10(frais+cep+acs+naf+parts); let epargneTot=r10(montant*0.10), epargneEch=r10(epargneTot/duree); let r=0.019, annuite=duree?(montant*r)/(1-Math.pow(1+r,-duree)):0; let echTot=r10(annuite+epargneEch); let capRest=montant, lignes='', totInt=0, totEch=0, base=g('date')?new Date(g('date')):new Date(); for(let i=1;i<=duree;i++){ let interet=r10(capRest*r); let cap, echAffichee=echTot; if(i${i}${fmtD(addMonths(base,i))}${fmt(cap)}${fmt(interet)}${fmt(epargneEch)}${fmt(echAffichee)}${fmt(capRest-cap)}`; capRest-=cap; } document.getElementById('calc').innerHTML=`Échéance CONSTANTE arrondie à 10 : Annuité Cap+Int = ${fmt(r10(annuite))} FCFA | Épargne / échéance = ${fmt(epargneEch)} FCFA | Échéance totale = ${fmt(echTot)} FCFA chaque mois | Intérêts totaux = ${fmt(totInt)} FCFA | Total payé = ${fmt(totEch)} FCFA`; document.getElementById('amort').innerHTML=`${lignes||''}
N°DateCapitalIntérêts 1,9%ÉpargneÉchéance totaleReste
Entre montant et durée

Capital : ${fmt(montant)} | Intérêts : ${fmt(totInt)} | Épargne : ${fmt(epargneTot)} | Total payé : ${fmt(totEch)} FCFA

`; let c1=(g('c1nom')+' '+g('c1prenom')).trim(), c2=(g('c2nom')+' '+g('c2prenom')).trim(); let map={'v-npret':g('npret'),'v-date':fmtD(base),'v-nom':g('nom'),'v-prenom':g('prenom'),'v-nais':g('nais')?fmtD(new Date(g('nais'))):'','v-compte':g('compte'),'v-montant':fmt(montant),'v-duree':duree,'v-parts':fmt(r10(parts)),'v-frais':fmt(frais),'v-cep':fmt(r10(cep)),'v-acs':fmt(r10(acs)),'v-naf':fmt(r10(naf)),'v-total':fmt(total),'v-nat':g('nat'),'v-tel':g('tel'),'v-quartier':g('quartier'),'v-maison':g('maison'),'v-objet':g('objet'),'v-garantie':g('garantie'),'v-ech1':duree?fmtD(addMonths(base,1)):'-','v-echN':duree?fmtD(addMonths(base,duree)):'-','v-ech':fmt(echTot),'v-ech1Tot':fmt(echTot),'v-cautionBloq':fmt(montant*0.1),'v-epargneTot':fmt(epargneTot),'v-epargneEch':fmt(epargneEch),'v-c1':c1,'v-c2':c2,'v-c1nom':g('c1nom'),'v-c1prenom':g('c1prenom'),'v-c1nais':g('c1nais')?fmtD(new Date(g('c1nais'))):'','v-c1tel':g('c1tel'),'v-c1prof':g('c1prof'),'v-c1quartier':g('c1quartier'),'v-c1piece':g('c1piece'),'v-c1compte':g('c1compte'),'v-c2nom':g('c2nom'),'v-c2prenom':g('c2prenom'),'v-c2nais':g('c2nais')?fmtD(new Date(g('c2nais'))):'','v-c2tel':g('c2tel'),'v-c2prof':g('c2prof'),'v-c2quartier':g('c2quartier'),'v-c2piece':g('c2piece'),'v-c2compte':g('c2compte')}; for(let k in map){document.querySelectorAll('.'+k).forEach(e=>e.textContent=map[k])} } maj();