Skip to content

Instantly share code, notes, and snippets.

@tai-cha
Created June 9, 2019 10:28
Show Gist options
  • Save tai-cha/8b594daa8b75217bf3e554faaf755db7 to your computer and use it in GitHub Desktop.
Save tai-cha/8b594daa8b75217bf3e554faaf755db7 to your computer and use it in GitHub Desktop.
課題5の検証で毎回打つのめんどくさいから自動化した、コンソールにコピペでOK、データ変更は配列いじればOK
{
let data = [
["イギリス", 245, 63181, 2434],
["日本", 378, 126200, 4841],
["アメリカ", 9628, 327830, 20412],
["ロシア", 17098, 146804, 2097]
];
let form = document.forms[0];
let inputs = form.getElementsByTagName("input");
let submit = document.getElementById("submitButton");
data.forEach(countryInfo =>{
countryInfo.forEach((data, index) =>{{
inputs[index].value = data;
}});
submit.click();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment