30 lines
853 B
JavaScript
30 lines
853 B
JavaScript
var gen3 = 1.732050807569
|
|
var jld_calc_table = document.querySelector("#jld_calc");
|
|
|
|
//最终的线电压索引
|
|
var line_value_index_row = 1
|
|
var line_value_index_cell = 2
|
|
//最终的相电压索引
|
|
var xiang_value_index_row = 2
|
|
var xinag_value_index_cell = 2
|
|
// 计算线电压
|
|
function calc_line(xiang)
|
|
{
|
|
return xiang * gen3
|
|
}
|
|
//计算相电压
|
|
function calc_xiang(line)
|
|
{
|
|
return line / gen3
|
|
}
|
|
//实时刷新两个值
|
|
function refreshFunction() {
|
|
//计算线电压
|
|
jld_calc_table.rows[line_value_index_row].cells[line_value_index_cell].textContent =
|
|
calc_line(document.querySelector("#input_xiang").value)
|
|
//计算相电压
|
|
jld_calc_table.rows[xiang_value_index_row].cells[xinag_value_index_cell].textContent =
|
|
calc_xiang(document.querySelector("#input_line").value)
|
|
}
|
|
setInterval(refreshFunction, 500);
|
|
//设置样式
|