Skip to content

Instantly share code, notes, and snippets.

@arahansa
Created September 21, 2015 03:42
Show Gist options
  • Save arahansa/43f7546e081eada8a2b7 to your computer and use it in GitHub Desktop.
Save arahansa/43f7546e081eada8a2b7 to your computer and use it in GitHub Desktop.
javascript 원단위 절사 연습
var lastStaus = false;
function myFunction(){
console.log("체인지");
var currentMoney = $("#criteria").val();
if (currentMoney % 100 != 0 ){
alert("100원 단위로 돈을 입력하셔야 합니다");
lastStaus = false;
return false;
}
var price_week = currentMoney*7 * 0.7;
var price_month = currentMoney* 30 * 0.5;
price_week = Math.floor( price_week / 100 ) * 100;
price_month = Math.floor( price_month / 100 ) * 100;
$("#price_one").val(currentMoney);
$("#price_week").val(price_week);
$("#price_month").val(price_month);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment