我无法在Google上找到任何内容,很抱歉,如果这是重复的,但我的问题是我无法与任何内容互动。我使用jQuery创建了一个非常简单的贷款计算器,但你无法使用任何东西。应该是不会出现的滑块。这是网址:http://66.228.45.148:8081/
这是我的jQuery:
$( document ).ready(function() {
function update() {
$interest = 0.15 ;
$perday = 15 ;
$amount1 = $("#amount").val();
$dayscount = $("#days").val();
$amount2 = parseInt($amount1) + $interest * parseInt($amount1) + (parseInt($dayscount) * ($perday/100));
$apr = (($amount2-$amount1 / $amount1 ) / ((parseInt($dayscount)/365) * 10000)) ;
$("#amount2").val($amount2);
$("#amount3").val(parseFloat($amount2-$amount1).toFixed(2));
$("#amount4").val($apr);
}
debugger;
$("#slider1").slider({
max:350,
min:100,
step:10,
slide: function(event, ui) {
$("#amount").val(ui.value);
update();
}
});
function addDaysToDate(days) {
var mths = new Array("Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec");
var d = new Date();
d.setHours(d.getHours() + (24 * days));
var currD = d.getDate();
var currM = d.getMonth();
var currY = d.getFullYear();
return mths[currM] + " " + currD + ", " + currY;
}
$("#slider2").slider({
max:30,
min:1,
slide: function(event, ui) {
$("#days").val(ui.value);
$("#date").text(addDaysToDate(parseInt($("#days").val())));
update();
},
create: function(event, ui) {
$("#date").text(addDaysToDate(parseInt($("#days").val())));
}
});
$("#days").val($("#slider2").slider("value"));
$("#days").change(function(event) {
var data = $("#days").val();
if (data.length > 0)
{
if (parseInt(data) >= 0 && parseInt(data) <= 31)
{
$("#slider2").slider("option", "value", data);
}
else
{
if (parseInt(data) < 1)
{
$("#days").val("1");
$("#slider2").slider("option", "value", "1");
}
if (parseInt(data) > 31)
{
$("#days").val("31");
$("#slider2").slider("option", "value", "31");
}
}
}
else
{
$("#slider2").slider("option", "value", "1");
}
$("#date").text(addDaysToDate(parseInt($("#days").val())));
});
update();
});
这就是HTML:
Loan Amount<div id="slider1"></div>
Your Loan <input type="text" id="amount" value="100"/><br /><br />
Loan Length<div id="slider2"></div>
Days Loaned <input type="text" id="days" value="1"/><br /><br />
Repayment Date<br />
<div id="date"></div><br />
Your Loan
<input id="amount2" type="text" />
Interest
<input id="amount3" type="text" /><br />
APR
<input id="amount4" type="text" /><br />
我使用把手和Node.js,如果这意味着什么。先感谢您!我不知道自己做错了什么......
答案 0 :(得分:0)