user4fun Posted January 23, 2006 Share Posted January 23, 2006 Where would i use the <br> tag in this java script to start a new line with every documnet.writealso, I would like to limit the results to 2 dicimal placesThank youif (SalesPercent < 10) {document.write(Message1 + " " + SalesPercent + "%" + " "); document.write(MessageA + " " + "=" + " " + GainedCustomers + " ") ;document.write(MessageB + " " + "=" + " " + LostCustomers + " ");document.write(MessageC + " " + "=" + " " + ProfitEarned + "$" +" ");document.write(MessageD + " " + "=" + " " + LostPotentialProfit + "$");Thank you for being nice to the new guyEDITTINGOK AY, i figured one part out document.write(Message1 + " " + Math.round(SalesPercent) + "%" + "<br />"); still working on the decimal points lol Link to comment Share on other sites More sharing options...
pulpfiction Posted January 23, 2006 Share Posted January 23, 2006 Hi try this codefunction deci(){ var decimals=2 //# of decimal digits var original_number=12345.6789 // sample data var result1 = original_number * Math.pow(10, decimals) var result2 = Math.round(result1) var result3 = result2 / Math.pow(10, decimals) document.write(result3)}HTH Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now