Javascript/引数

sample1
sample1code
function s1Func(r){
  menseki = 3.14 * r * r;
  console.log(menseki);
}
sample2
sample2code
function sample2Func(num1, num2){
  console.log(num1 * num2);
}
	
sample3
sample3code
var jou = ["松", "イヌマキ", "イチイ"];
var raku = new Array("紅葉", "ハナミズキ", "ヤマボウシ");
function s3Func(x){
	var s3Div = document.getElementById("s3Div");
	for(i=0; i
sample4
sample4code
var s4Img01 = document.getElementById("s4Img01");
var s4Img02 = document.getElementById("s4Img02");
var s4Array = ["../../img/m4.jpg", "../../img/reims.jpg", "../../img/jura.jpg"];
s4Img01.style.width = "200px";
s4Img01.style.height = "150px";
s4Img02.style.width = "200px";
s4Img02.style.height = "150px";
function s4Func(arg01, arg02){
  s4Img01.src = s4Array[arg01];
  s4Img02.src = s4Array[arg02];
}
	
sample5
  • red
  • purple
  • navy
smaple5code
var s5Div = document.getElementById("s5Div");
s5Div.style.width = "100px";
s5Div.style.height = "100px";
s5Div.style.border = "1px solid black"
document.getElementById("s5Ul").style.cursor = "pointer";
function s5Func(color){
  s5Div.style.background = color;
}
	
sample6
check01 check02 check03
sample6code
function s6Func(bool){
  s6Form.check01.checked = bool;
  s6Form.check02.checked = bool;
  s6Form.check03.checked = bool;  
}
	
sample7 s7p1 s7p2
s7Div
sample7code
function s7Func(s7Str){
  const s7Div = document.getElementById("s7Div");
  s7Div.innerHTML = s7Str;
}
	
sample8
Aさん Bさん Cさん Dさん
営業成績
Aさん
Bさん
Cさん
Dさん
sample8code
const graphA = document.getElementById("graphA");
const graphB = document.getElementById("graphB");
const graphC = document.getElementById("graphC");
const graphD = document.getElementById("graphD");
function s8Func(graph, value){
  graph.style.width = value + "px";
};