Jump to content
Sign in to follow this  
gaby

Script Convertor Valutar Ron-usd-euro

Recommended Posts

Un exemplu:

66827092ah1.png

Codurile sunt integrate in codul HTML al unei pagini oarecare pentru a putea fi usor de urmarit si vizualizat:

<!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>PC Troubleshooting Convertor Valutar</title>
</head>

<body>

<center><strong>Convertor valutar </strong>
<form name="convert" class="form" action="#" method="post">
<table width="120" align="center"  border="0" cellpadding="1" cellspacing="0" bgcolor="" class="small">
<tr>
<td colspan="2" ><div style="float:left">Suma:</div> <div style="float:right"><a href="#" class="small_red" onclick="Moneda(forms['convert']);return false">Schimba</a></div></td></tr>
<tr><td><input onkeyup="Modificare(this.form)" onblur="Modificare(this.form)" type="text" name="pret_1" size="11" value="0" /></td><td><input onfocus="this.blur()" type="text" value="" onclick="Moneda(this.form)" name="moneda" readonly="readonly" style="font-size:11px" size="1" /></td>
</tr>
<tr>
<td colspan="2" valign="top">Conversie:</td></tr>
<tr>
<td><input type="text" name="pret_2" value="0" size="11" readonly="readonly" /></td><td><input type="text" value="" name="moneda_2" onfocus="this.blur()" readonly="readonly" style="font-size:11px" size="1" /></td>
</tr>
<tr>
<td ><input type="text" name="pret_3" value="0" size="11" readonly="readonly" /></td><td><input type="text" value="" name="moneda_3" onfocus="this.blur()" readonly="readonly" style="font-size:11px" size="1" /></td>
</tr>
</table>
</form>
<script type="text/javascript">
var convert1=1;           /* conversie RON - RON*/
var convert2='3.7322'; /* conversie EURO - RON*/
var convert3='2.3826'; /* conversie USD - RON*/
var moneda=new Array();
moneda[1]='RON';
moneda[2]='EURO';
moneda[3]='USD';

document.forms['convert'].moneda.value=moneda[1];
document.forms['convert'].moneda_2.value=moneda[2];
document.forms['convert'].moneda_3.value=moneda[3];

 function Modificare(f) {
if (f.pret_1.value> 1000000000000)
    f.pret_1.value=1000000000000;
var temp=f.moneda.value;
if (temp==moneda[1])
 {
  f.pret_2.value=f.pret_1.value/convert2;
  f.moneda_2.value=moneda[2]
  f.pret_3.value=f.pret_1.value/convert3;
  f.moneda_3.value=moneda[3]
 }
if (temp==moneda[2])
 {
  f.pret_2.value=f.pret_1.value*convert2;
  f.moneda_2.value=moneda[1]
  f.pret_3.value=f.pret_1.value*convert3/convert2;
  f.moneda_3.value=moneda[3]
 }
if (temp==moneda[3])
 {
  f.pret_2.value=f.pret_1.value*convert3;
  f.moneda_2.value=moneda[1]
  f.pret_3.value=f.pret_1.value*convert2/convert3;
  f.moneda_3.value=moneda[2]
 }

    f.pret_1.value=Math.round(f.pret_1.value*10000)/10000;
  f.pret_2.value=Math.round(f.pret_2.value*10000)/10000;
  f.pret_3.value=Math.round(f.pret_3.value*10000)/10000


             } /**/
 function Moneda(f) {
var temp=f.moneda.value;
if (temp==moneda[1]) f.moneda.value=moneda[2];
if (temp==moneda[2]) f.moneda.value=moneda[3];
if (temp==moneda[3]) f.moneda.value=moneda[1];
Modificare(f);
           } /**/</script></center>
</body>
</html>
[/code]

Share this post


Link to post
Share on other sites

nu, asta este singura mica problema... cursul trebuie sa il reactualizezi tu manual in script:


var convert1=1;          /* conversie RON - RON*/
var convert2='3.7322'; /* conversie EURO - RON*/
var convert3='2.3826'; /* conversie USD - RON*/[/code]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×