Показать сообщение отдельно
  #9 (permalink)  
Старый 18.12.2020, 18:35
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,103

mat45,

<!DOCTYPE html>
<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  input[id^="ploshad"] {
      width: 3em;
  }
  input[id^="koordinat"] {
      width: 13em;
  }

  </style>
</head>
<body>
<input type="text" id="ploshad1">
<input type="text" id="koordinat1">
<br>
<input type="text" id="ploshad2">
<input type="text" id="koordinat2">
<br>
<input type="text" id="ploshad3">
<input type="text" id="koordinat3">
<br>
<input type="text" id="ploshad4">
<input type="text" id="koordinat4">
<br>
<input type="text" id="ploshad5">
<input type="text" id="koordinat5">
<br>
<input type="text" id="ploshad6">
<input type="text" id="koordinat6">
<br>
<input type="text" id="ploshad7">
<input type="text" id="koordinat7">
<br>
<input type="text" id="ploshad8">
<input type="text" id="koordinat8">
<br>
<input type="text" id="ploshad9">
<input type="text" id="koordinat9">
<br>
<input type="text" id="ploshad10">
<input type="text" id="koordinat10">
<br>
<textarea id=mytextarea cols="35" rows="10">
75;180;0;170;20;230;30;250;0;
80;180;0;170;20;230;30;250;0;
75;180;0;170;20;230;30;250;0;
70;180;0;170;20;230;30;250;0;
80;180;0;170;20;230;30;250;0;
65;180;0;170;20;230;30;250;0;
90;180;0;170;20;230;30;250;0;
70;180;0;170;20;230;30;250;0;
60;180;0;170;20;230;30;250;0;</textarea>
<script>
let ar = mytextarea.value.trim().split(/[\n\r]+/);
ar.forEach((str, i) => {
let [a, b] = str.split(/(?<=^\d+);/);
let input = document.getElementById(`ploshad${++i}`);
input.value = a;
input = document.getElementById(`koordinat${i}`);
input.value = b;
});
</script>
</body>
</html>
Ответить с цитированием