글쎄, 자바 스크립트에 익숙하지 않았습니다. C++에서 C# VB를 완성했습니다. 그러나이 자바 스크립트 책은 이해하기 어렵습니다. 아무 것도 아니지만 살펴볼 전체 코드는 없습니다. 어쨌든 나는 간단한 프로젝트를하고 있지만 어디서 잘못 될지 이해하지 못한다. CDATA는 제가 잘못 될 것이라고 믿습니다. 이것은 내 두 번째 프로젝트이며 첫 번째 작업은 CDATA와 Var가 나올 때까지 쉽지 않았습니다. 나는이 코드가 구식임을 알고 있지만, 기본적인 JS를 배우고 내 방식대로 작업하기 위해 책을 따라 가고있다. Heres는 코드 :자바 스크립트에서 CDATA에 문제가 있습니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Largest Islands</title>
<meta http-equiv="content-type" content="text/html; charset=iso-
8859-1" />
</head>
<body>
<h1>Largest Islands</h1>
<script type="text/javascript">
/* <![CDATA[ */
var island1Name = "Greenland";
var island2Name = "New Guinea";
var island3Name = "Borneo";
var island4Name = "Madagascar";
var island5Name = "Baffin";
var island1Size = 2175600;
var island2Size = 790000;
var island3Size = 737000;
var island4Size = 587000;
var island5Size = 507000;
document.write("<p>The largest island
in the world is " + island1Name
+ " with " + island1Size + " miles.</p>");
document.write("<p>The second largest island
in the world is " + island2Name
+ " with " + island2Size + " miles.</p>");
document.write("<p>The third largest island
in the world is " + island3Name
+ " with " + island3Size + " miles.</p>");
document.write("<p>The fourth largest island
in the world is " + island4Name
+ " with " + island4Size + " miles.</p>");
document.write("<p>The fifth largest island
in the world is " + island5Name
+ " with " + island5Size + " miles.</p>");
/* ]]> */
</script>
</body>
</html>
의 난 그냥 내가 잘못 가고있는 곳을 파악하는 도움을 필요로하는 매우 간단한 프로젝트. 사전에 감사합니다.
아니요, 아니요, CDATA가 잘못 될 곳이 아닙니다. 그것은 무엇을해야 하는가? 그게 옳은 일이 아닌가? 오류가 있습니까? – ceejayoz
그럼 작동하지 않는 것은 무엇입니까? – Bergi