Jump to content

Cum Creez Un Calculator Asemanator?


alex008

Recommended Posts

Serios acum, îţi baţi joc de noi?

Scuze, n-am citit.

Te referi la acel calculator cu lungime, lăţime, and other shits?

nu prea am inteles la ce te referi cu batutu de joc...

Da ma refer la calculatorul ala in care introduci lungime latime stii ca metrul patrat e atat si sa iti calculeze automat cat costa pe tot covorul in functie de dimensiunile date.

wtf dude...Ce e cu linku ala? :stars: Refa linkul te rog :yes:

linkul n-are nimic e ok

Link to comment
Share on other sites

nu prea am inteles la ce te referi cu batutu de joc...

Da ma refer la calculatorul ala in care introduci lungime latime stii ca metrul patrat e atat si sa iti calculeze automat cat costa pe tot covorul in functie de dimensiunile date.

Ahh... :| asta vroiai tu...Nu intelesesem ce vroiai... (Imi cer scuze pt. reactia de mai devreme :bag: )

              

 

 

Link to comment
Share on other sites

Creezi o pagina web, de forma:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>
[/code] inainte de inchiderea tag-ului head, adauga:
[code]<script type="text/javascript">
var pretMetru = 9;
var pretMinimTransportGratis = 100;
var pretTransport = 15;

function getInputValue(elmentId) {
var value = parseFloat(document.getElementById(elmentId).value);
return (value ? value : 0);
}
function calculeaza() {
var covor1Latime = getInputValue('covor1Latime');
var covor1Lungime = getInputValue('covor1Lungime');
var covor2Latime = getInputValue('covor2Latime');
var covor2Lungime = getInputValue('covor2Lungime');
var covor3Latime = getInputValue('covor3Latime');
var covor3Lungime = getInputValue('covor3Lungime');

var totalPrice = (covor1Latime * covor1Lungime + covor2Latime * covor2Lungime + covor3Latime * covor3Lungime) * pretMetru / 10000;

if (totalPrice < pretMinimTransportGratis) {
totalPrice = totalPrice + pretTransport;
document.getElementById('transport').innerHTML = pretTransport + ' RON';
} else {
document.getElementById('transport').innerHTML = 'gratuit';
}
document.getElementById('rezultat').innerHTML = totalPrice + ' RON';
}
</script>
Intre etichetele body, adauga:
<div id="main_container">
<div id="container">
<div class="article">
<div class="article_content">
<h1>Preturi</h1>
<div class="oferta_home clearfix" style="background: none;">
<div class="oferta_right" style="float: left;">
<div class="calculator">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90"></td>
<td width="80">Lungime: (cm)</td>
<td width="80">Latime: (cm)</td>
</tr>
<tr>
<td>Covor 1</td>
<td><input type="text" value="250" class="text" name="covor_1_lungime" id="covor1Lungime" onfocus="this.value='';"/></td>
<td><input type="text" value="200" class="text" name="covor_1_latime" id="covor1Latime" onfocus="this.value='';"/></td>
</tr>
<tr>
<td>Covor 2</td>
<td><input type="text" value="" class="text" name="covor_2_lungime" id="covor2Lungime" onfocus="this.value='';"/></td>
<td><input type="text" value="" class="text" name="covor_2_latime" id="covor2Latime" onfocus="this.value='';"/></td>
</tr>
<tr>
<td>Covor 3</td>
<td><input type="text" value="" class="text" name="covor_3_lungime" id="covor3Lungime" onfocus="this.value='';"/></td>
<td><input type="text" value="" class="text" name="covor_3_latime" id="covor3Latime" onfocus="this.value='';"/></td>
</tr>
<tr>
<td>Transport</td>
<td id="transport">15 RON</td>
<td>&nbsp;</td>
</tr>
<tr class="total">
<td>Pret total:</td>
<td><b id="rezultat">60 RON</b></td>
<td>&nbsp;</td>
</tr>
</table>
<input type="button" value="Calculeaza!" onclick="calculeaza();"/>
</div>
<div style="margin:48px 0px 0px 150px;">Transport gratuit in Bucuresti la comenzi de peste 100 RON</div>
</div>
</div>
</div>
</div>
</div>
</div>[/code]

[b][i]P.S:[/i][/b] Este doar un exemplu, folosind informatiile gasite la adresa respectiva.

  • Upvote 1

Te-ai inregistrat? Ne-ar placea sa te prezinti.

Cum pot sustine forumul?
Cumpara de la eMag folosind acest link.
--------------------
oG2BN9d.gifse1WdXd.gifQG6MtmI.gifRHYjDzD.gifG5p1wui.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.