Решить на знание циклов в языке java script пользователь последовательно вводит 10 чисел,вывести на экран произведение этих чисел.

innabat1 innabat1    3   02.09.2019 21:10    0

Ответы
azharik2k17 azharik2k17  06.10.2020 13:11
Http://www.w3.org/1999/xhtml">
<head>
<script>
function doProcess() {
var fields=document.forms[0].getElementsByTagName('INPUT');
var val=0;
var total=1;
for (var i=0;i<fields.length;i++) {
if ((fields[i].type=='text')&&(fields[i].name.indexOf('number')==0)) {
val=parseInt(fields[i].value);
total*=val*1;
}
}
document.forms[0].pr.value = total;
}
</script>
</head>
<body align="center">
<form method = "post" action = "/cgi-bin/formmail" >
<input name = "number0" type = "text" size = "4"
maxlength = "5" />
<input name = "number1" type = "text" size = "4"
maxlength = "5" />
<input name = "number2" type = "text" size = "4"
maxlength = "5" />
<input name = "number3" type = "text" size = "4"
maxlength = "5" />
<input name = "number4" type = "text" size = "4"
maxlength = "5" />
<input name = "number5" type = "text" size = "4"
maxlength = "5" />
<input name = "number6" type = "text" size = "4"
maxlength = "5" />
<input name = "number7" type = "text" size = "4"
maxlength = "5" />
<input name = "number8" type = "text" size = "4"
maxlength = "5" />
<input name = "number9" type = "text" size = "4"
maxlength = "5" />
<br><br>
<input type="button" name="click1" value="Подсчитать" onClick="doProcess()">
<p>
<label>Произведение:
<input name = "pr" type = "text" size = "20"
maxlength = "50" />
</form>
</body>
</html>
ПОКАЗАТЬ ОТВЕТЫ
Другие вопросы по теме Информатика