nikto93i7,
мысли вслух ...
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<script>
function bindLate(a, b) {
return function() {
return a[b].apply(a, arguments)
}
}
var fn = {
num: 7
},
repeat = bindLate(fn, "repeat");
fn.repeat = function(a, b) {
for (var c = ["function" == typeof a ? a() : a], d = 0; d < this.num; d++) c.push("function" == typeof b ? b() : b);
return c
};
function tcoSavings()
{
return " * "
}
function priceDifference()
{
return " ! "
}
function negative() {
return repeat(priceDifference, 0)
};
function positive() {
return repeat(0, tcoSavings)
};
</script>
<body>
<input class="rangenain" id="term1" type="range" step=1 min="1" max="10" value="7" onchange="fn.num = this.value">
<input name="" type="button" value="test positive" onclick="alert(positive());">
<input name="" type="button" value="test negative" onclick="alert(negative());">
</body>
</html>