News:

Wondering if this will always be free?  See why free is better.

Main Menu

Javascript question...

Started by MoreBloodWine, December 31, 2014, 05:35:30 AM

Previous topic - Next topic

MoreBloodWine

<script language="javascript">
var cost = {COST};
var multiplier = 3;
var total = cost*multiplier;
alert(total.toFixed(4))
</script>


Ok, so the math gives me the answer I'm after in an alert but how can I do away with the alert and have the alerts "answer" instead be a variable I can use anywhere on the page to display.

Ex.

$hello = 'goodbye';

Now I can use echo $hello; anywhere on a page to display goodbye.

Ty in advance.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Arantor

var total = (cost*multiplier).toFixed(4);

Now you have the variable total you can use.

MoreBloodWine

Quote from: Arantor on December 31, 2014, 05:53:41 AM
var total = (cost*multiplier).toFixed(4);

Now you have the variable total you can use.
Ty for that.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: