Javascript 在<;中显示计算的算术平均值;td>;单击按钮时
请帮我完成这件事,我一事无成 我已经在图片中解释了完成目标是什么。 这是一个成绩计算器 有三种等级。。它应该计算每个类别的算术平均值和所有等级的算术平均值,无论它们是哪一类别 计算值应显示在适当的块上,如图所示Javascript 在<;中显示计算的算术平均值;td>;单击按钮时,javascript,jquery,html,css,html-table,Javascript,Jquery,Html,Css,Html Table,请帮我完成这件事,我一事无成 我已经在图片中解释了完成目标是什么。 这是一个成绩计算器 有三种等级。。它应该计算每个类别的算术平均值和所有等级的算术平均值,无论它们是哪一类别 计算值应显示在适当的块上,如图所示 input[type="number"]{ color : transparent; text-shadow : 0 0 0 #000; } input[type="number"]:focus{ outline : none; } </style>
input[type="number"]{
color : transparent;
text-shadow : 0 0 0 #000;
}
input[type="number"]:focus{
outline : none;
}
</style>
<body>
<div id="stranica" style="display: inline-block; position: left;">
<button type="button" onclick="javascript:dodajocenu();"> Add grade</button>
</div>
<div id="desna" style="display: inline-block; position: absolute; text-align: center;">
<button type="button" onclick=""> Calculate </button>
<br><br>
<table border="1">
<tbody>
<tr>
<td style="width:70px; text-align: center;">Written test</td>
<td style="width:70px; text-align: center;">Essay</td>
<td style="width:70px; text-align: center;">Class Activity</td>
</tr>
<tr>
<td style="text-align: center;"> </td> <!-- insert arithmetic mean of all Writtentest, inside td-->
<td style="text-align: center;"></td> <!-- insert arithmetic mean of all Essay, inside td-->
<td style="text-align: center;"></td> <!-- insert arithmetic mean of all ClassActivity, inside td-->
</tr>
</tbody>
</table>
<br>
<table border="1">
<tbody>
<tr>
<td style="width:140px; text-align: center;">Arithmetic mean of all grades</td>
</tr>
<tr>
<td style="text-align: center;"> </td> <!-- insert arithmetic mean of all numbers-->
</tr>
</tbody>
</table>
</div>
</body>
<script>
var ocena = 0;
var stranica = document.querySelector("#stranica")
function removeElement(obrisi) {
var dugme = obrisi.target;
stranica.removeChild(dugme.parentElement)
}
function dodajocenu() {
ocena++;
//create textbox
var input = document.createElement('input');
input.type = "number";
input.setAttribute("max",5);
input.setAttribute("min",1);
var myParent = document.body;
//Create array of options to be added
var array = ["Written test","Essay","Class Activity"];
//Create and append select list
var selectList = document.createElement('select');
selectList.id = "mySelect";
myParent.appendChild(selectList);
//Create and append the options
for (var i = 0; i < array.length; i++) {
var option = document.createElement('option');
option.value = array[i];
option.text = array[i];
selectList.appendChild(option);
}
//create remove button
var remove = document.createElement('button');
remove.onclick = function(obrisiocenu) {
removeElement(obrisiocenu);
}
remove.setAttribute("type", "dugme");
remove.innerHTML = "-"; //delete
var item = document.createElement('div')
item.classList.add("item")
item.appendChild(input);
item.appendChild(selectList);
item.appendChild(remove);
stranica.appendChild(item)
}
</script>```
输入[type=“number”]{
颜色:透明;
文本阴影:0#000;
}
输入[type=“number”]:焦点{
大纲:无;
}
加分
算计
笔试
散文
课堂活动
所有等级的算术平均数
变异系数ocena=0;
var-stranica=document.querySelector(“#stranica”)
功能删除元素(obrisi){
var dugme=obrisi.target;
stranica.removeChild(dugme.parentElement)
}
函数dodajocenu(){
ocena++;
//创建文本框
var input=document.createElement('input');
input.type=“number”;
输入.setAttribute(“最大”,5);
输入.setAttribute(“min”,1);
var myParent=document.body;
//创建要添加的选项数组
变量数组=[“笔试”、“作文”、“课堂活动”];
//创建并附加选择列表
var selectList=document.createElement('select');
selectList.id=“mySelect”;
myParent.appendChild(选择列表);
//创建并附加选项
对于(var i=0;i
var ocena=0;
功能删除元素(obrisi){
var dugme=obrisi.target;
document.getElementById(“stranica”).removeChild(dugme.parentElement)
}
函数dodajocenu(){
ocena++;
//创建文本框
var input=document.createElement('input');
input.type=“number”;
输入.setAttribute(“最大”,5);
输入.setAttribute(“min”,1);
var myParent=document.body;
//创建要添加的选项数组
变量数组=[“Kontrolni”、“Vezbe”、“Aktivnost”];
//创建并附加选择列表
var selectList=document.createElement('select');
selectList.id=“mySelect”;
myParent.appendChild(选择列表);
//创建并附加选项
对于(var i=0;i
Dodaj ocenu
伊兹拉库纳普罗塞克
康特罗尼
维兹比
阿基维诺斯特
扎克尔朱克纳
尝试一下均值计算代码,你能用英语翻译一些关键词吗?我改了一些文本,希望能有所帮助。看来你还没有做任何事情来计算均值。这听起来像是家庭作业,所以请参考你所学的知识并加以应用。当您在该实现中遇到特定问题时,请至少显示尝试实现该解决方案的代码。您提供的JS代码是关于添加分数的。关于平均数的计算没有什么,不是家庭作业,而是个人项目。我们甚至还没有开始JS。