小编Las*_*sha的帖子

如何使用jQuery更改输入border-color,具体取决于其值?

我对jQuery有疑问.我的代码在下面工作正常; 它会input border-color根据其输入的值进行更改.但如果在input页面加载中的值不会改变它border-color.如何在border-color页面加载后从头开始进行更改?

谢谢 :)

<input type="text" class="col" value="">


// When the <input>'s value changes
$("input").change(function() {

// If the value is less than 7, add a red border
if ($(this).val() < 7) {
    $(this).css("border", "5px solid red");
}

// Else if the value is equal to 7, add a green border
else if ($(this).val() == 7) {
    $(this).css("border", "5px solid green");
}

// Else if the value is greater than 7, …
Run Code Online (Sandbox Code Playgroud)

jquery input colors

13
推荐指数
2
解决办法
5万
查看次数

如何在 PHP 中计算 NPER

我不知道如何在 php 中计算 NPER。

我在谷歌上没有找到任何文章。

我的数学很弱,因为我正在寻求帮助。

这就是我到目前为止所做的:(

public function Nper($interest, $payment, $loan){
       $nperC = Log10($payment/($payment+$loan+$interest))/Log10(1+$interest);
       return $nperC;
}
if(isset($_POST['NperSubmit'])){
        $calc = new CalculatorModel();
        $months = $calc->Nper($_POST['interest'], $_POST['payment'], $_POST['loan']);
        echo round($months,2);
}
Run Code Online (Sandbox Code Playgroud)

工作代码(来自 Tijo John 的回答)

public function Nper($interest, $payment, $loan){
        $interest = $interest / 1200;
        $nperC = Log10 ($payment/ ($payment- $loan * $interest)) / Log10(1 + $interest);

        return $nperC;
    }
    $calc = new CalculatorModel();
    $months = $calc->Nper($_POST['interest'], $_POST['payment'], $_POST['loan']);
    echo round($months,2);
Run Code Online (Sandbox Code Playgroud)

谢谢 :))

php math

4
推荐指数
1
解决办法
889
查看次数

标签 统计

colors ×1

input ×1

jquery ×1

math ×1

php ×1