ExXxTaSy,
<html>
<head>
<title></title>
<script>
var price1 = 10, price2 = 20, price3 = 30;
function conversion(val) {
var div = document.getElementById("div"), price = document.getElementById("price");
if (isNaN(val)) { div.innerHTML = ""; price.innerHTML = ""; }
else {
switch (true) {
case (val <= 0): {
div.innerHTML = "";
price.innerHTML = ""; break;
}
case (val < 10): {
div.innerHTML = val*price1;
price.innerHTML = price1; break;
}
case (val >= 10 && val < 50): {
div.innerHTML = val*price2;
price.innerHTML = price2; break;
}
case (val > 50): {
div.innerHTML = val*price3;
price.innerHTML = price3; break;
}
}
}
}
</script>
</head>
<body>
<input type="text" onBlur="conversion(this.value)" onChange="conversion(this.value)" onkeypress="conversion(this.value)" onkeyup="conversion(this.value)" value="1" id="txt">
<div id="div"></div><div id="price"></div>
<script>window.onload = conversion(document.getElementById("txt").value);</script>
</body>
</html>