PDA

View Full Version : Typo - HC - Credit Converter



Verrou
22-08-2007, 06:56 AM
Ok, i'm trying to make a converter so that if you typed in "4200" into the credits form, the hc form would come up 70 and the typo form would come up 1.

But then i want it to be able to do it the other way around and so forth.

Eg. enter 1 typo, 70hcs and 4200 credits come up and if i typed 70 hcs 4200 credits and 1 typo would come up...if ya get it please help.

This is what i have so far:

<html>

<head><title>Habbo Credit Converter || AndreHamon.com</title>

<body>

<script language="JavaScript">

function hctotypo( hc ) {

document.rechner.typo.value = hc / 70;

}

function credittohc( credit ) {

document.rechner.hc.value = credit / 60;

}


function hctocredit( hc ) {

document.rechner.credit.value = hc * 60;

}

</script>



<form name="rechner">

<table align="center">

<tr>
<td width="50%">Credits:</td>

<td width="50%"><input name="credit" type="text" onkeyup="credittohc( this.value );" size="30">
</td>

</tr>

<tr>

<td width="50%">HC(s):</td>
<td width="50%"><input name="hc" type="text" onkeyup="hctotypo( this.value );" size="30">
</td>

</tr>

<tr>

<td width="50%">Typos:</td>

<td width="50%"><input name="typo" type="text" size="30">
</td>

</tr>


</table>

</form>

</body>

</html>

+rep to any help/responses.

Thanks,
Verrou

Splinter
22-08-2007, 08:30 AM
Well you just need to convert all the values into a common unit. So treat them all by say the value of 1 credit so a HC is say 70, a typo is then 4200 credits so its then a simple maths engine.

Verrou
23-08-2007, 04:57 AM
Explain abit more indepth please?

Want to hide these adverts? Register an account for free!