JavaScript 경고 상자에 새 줄을 추가하려면 "\n"을 사용하십시오.
alert("Line One\n Line Two"); 예시
JavaScript의 경고 상자에 새 줄을 추가하여 다음 코드를 실행할 수 있습니다.
라이브 데모
<html>
<head>
<script>
<!--
function Warn() {
alert ("This is a warning message!\nThis is a new line.");
document.write ("This is a warning message!");
}
//-->
</script>
</head>
<body>
<p>Click the following button to see the result: </p>
<form>
<input type="button" value="Click Me" onclick="Warn();" />
</form>
</body>
</html>