2
HTML 차트 버튼을 누르면 createChart() 메소드가 활성화됩니다. 그러나 텍스트 영역의 값이 25 자 이하이면 웹 페이지가 정지됩니다. 또한 문자 "a"만이 메서드로 참조되고 있습니다.짧은 문자열로 인해 웹 페이지가 고정됩니다.
<script type = "text/javascript">
orangeBar = "./orange.gif";
function createChart()
{
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
textValue = document.getElementById("text").value;
max = 0;
for (i=0;i<alphabet.length;i++)
{
value = numberOf(alphabet[i], textValue);
if (value > max)
{
max = value;
}
}
document.write(max);
}
function numberOf(letter, string)
{
count = 0;
for (i=0; i<string.length; i++)
{
if (string[i].toLowerCase() == letter)
{
count++;
}
}
return count;
}
</script>
감사합니다. 나는 코딩에 새로운 브랜드입니다. 나는 어떤 질문에도 대답 할 수있다.
,이 모든 변수 VAR를 사용한다 - 계산, 최대 ... http://scribu.net/blog/javascript-var-keyword-for -php-developers.html –
좋은 주인님 ... 정말 고마워요! <3 – Karri