Luc*_*ano -1 javascript jquery
我正在尝试创建一个计算器,它给出了一个人收入的百分比.我是JavaScript和jQuery的新手.
这给了
未捕获的ReferenceError:未定义计算未
捕获的语法错误:意外的标记
function calculate();
{
var annual_Income = jQuery('#a1').val();
var income_Pledged = (jQuery('#a2').val()/100;
var x = annual_Income * income_Pledged;
var weekly = Math.floor(x/52);
var monthly = Math.floor(x/12);
var quarterly = Math.floor(x/4);
var annual_total = weekly + monthly + quarterly;
var htmlstr = '<div> <p>Annual Household Income: $ ' + annual_Income + '</p><p>Weekly Pledge: $ ' + weekly + '</p><p>Monthly Pledge: $ ' + monthly +
'</p><p>Quaterly Pledge: $ ' + quarterly + ' </p><p>Annual Pledge: $ ' + annual_total + '</p>';
//alert(x);
jQuery( "div.result-container" ).html( htmlstr );
}
Run Code Online (Sandbox Code Playgroud)
小智 5
从第一行删除分号:
function calculate();
Run Code Online (Sandbox Code Playgroud)
您还在以下行中有不平衡的括号:
var income_Pledged = (jQuery('#a2').val()/100;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
56 次 |
| 最近记录: |