Javascript/substring()

解説 indexStart から indexEnd 未満の文字を取り出す。

str.substring(indexStart, indexEnd)

sample1
sample1code
function s1Func(){
  var s1Text = document.getElementById("s1Text").value;
  var s1Start = document.getElementById("s1Start").value;
  var s1End = document.getElementById("s1End").value;
  var aaa = s1Text.substring(s1Start, s1End);
  console.log(aaa);
}
	
sample2
s2Div
sample2code
function s2Func(){
  var s2Str = "イチゴシェイク";
  var s2 = s2Str.substring(3);
  var s2Div = document.getElementById("s2Div");
  s2Div.innerText = s2;
}