사용자가 텍스트 상자에 이름을 입력 한 다음 버튼을 클릭 할 때 JavaScript를 사용하여 선택 윤곽을 시작하려고합니다. 그것을하는 방법에 관해서는 아이디어가 있지만, 스크립트는 결코 완벽하게 작동하지 않습니다. 어떤 도움을 주셔서 감사합니다! 여기 사용자 입력을 기반으로 JavaScript로 선택 윤곽을 시작하는 방법은 무엇입니까?
는 지금까지이 작업은 다음과 같습니다<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function StartMarquee() {
var text = document.getElementById(namebox);
if (text != null) {
document.write("<marquee behavior='scroll' direction='right'>Hello " + text + "!</marquee>");
}
else {
alert("Enter your name first!!!");
}
}
</script>
</head>
<body>
<table style="margin:0px auto 0px auto;">
<tr><td>Enter your name!</td>
<td><input type="text" id="namebox"/></td>
<td><input type="button" value="Enter" onclick="StartMarquee()"/></td></tr>
</table>
</body>
</html>
"전혀 작동하지 않는다"는 것은 무엇을 의미합니까? –
완전히 작동하지 않는다는 것은 "사용자 이름을 먼저 입력하십시오!"라는 경고 메시지가 울립니다. 또는 "Hello null!"이라고 말한 윤곽을 볼 수 있습니다. –