안녕하세요, 텍스트 드롭 다운 목록에서 원하는 자질을 클릭하면 텍스트 영역에 표시됩니다이 자바 스크립트 코드가 있습니다. 이제이 오류가 발생했습니다 TypeError : d.textarea1이 정의되지 않았습니다 d.textarea1.value = sChoices;TypeError : d.textarea1은 정의되지 않았습니다. d.textarea1.value = sChoices;
내 코드에 이상이 있습니까?
<!DOCTYPE html>
<html>
<head>
<title>List Box 4 Example</title>
<script type="text/javascript">
function tellMe(d){
var sChoices ="";
for(i=0; i<d.listbox.options.length; i++){
if(d.listbox.options[i].selected == true){
sChoices += d.listbox.options[i].text +"\n";
}
}
d.textarea1.value = sChoices;
}
</script>
</head>
<body bgcolor="lightgreen">
<form name="form1">
<p>Girl's quaalities you want?</p>
<select name="listbox" onchange="tellMe(this.form)" multiple>
<option>Pretty</option>
<option>Sexy</option>
<option>Hot</option>
<option>Intelligent</option>
<option>Funny</option>
</select>
</form>
<br />
You Choose:<br />
<textarea rows="4" cols="20" name="textarea1"></textarea>
</body>
</html>
어떤 도움이라도 대단히 감사합니다! 감사합니다
나는 여전히 "d"를 이해할 수 없다. 그것은 컨트롤이나 폼 이름의 일부인가? 어쩌면 자바 스크립트는 내가했던 것과 같은 방식으로 혼란 스러웠을 것입니다. –
이미 해결되었습니다! textarea가 그 오류를 만나는 이유의 형태입니다. – bobcatnyxz
나는 그게 내 나쁜 것을 알아 차리지 못했습니다. – bobcatnyxz