Created
September 21, 2015 03:42
-
-
Save arahansa/43f7546e081eada8a2b7 to your computer and use it in GitHub Desktop.
javascript 원단위 절사 연습
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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