다음 예와 같이 내 텍스트 상자에 단어를 입력하려고합니다. (thomas) = "t, th, tho, thom, thoma, thomas ". 그 일을하기 위해 내가 charAt에 무엇을 입력합니까? 또는 다른 것을 추가해야합니까? 미리 감사드립니다! Array.from
String#slice
및 방법을 사용 charAt 한 글자 + 한 글자 등으로 자바를 표시하는 단어
<head>
<meta charset="utf-8">
<script>
function printit()
{
var temptext = document.getElementById("mytext").value;
var tempa = temptext.charAt();
document.getElementById("translated").innerHTML=tempa;
}
</script>
</head>
<body>
<h1> </h1>
<form name="f1">
<input type="text" id="mytext" value="" />
<input type="button" value="print" onclick="printit()"/>
</form>
<div id="translated" style="background-color:gray"></div>
</body>
</html>
[루프] (https : //developer.mozilla) 내의 ['substring'] (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring) .org/ko-ko/docs/Web/JavaScript/Reference/Statements/for)는 더 간단합니다. – Teemu
@Teemu 참으로 :) – xShirase