0
このコードは数週間前に正しく動作するように見えました。HTMLとjavascriptが正しくコンパイルされない
しかし、今では分岐が完全に壊れているように見えます(ブラウザの種類はほとんど意味がありません)。
誰も何故それがもはや機能しない理由を知っていますか?ここで
はコードです:
<!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>
<meta name="generator" content="HTML Tidy for Linux (vers 6 November 2007), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Examples of Strings</title>
<script type="text/javascript">
//<![CDATA[
<!-- hide me
// get a name
var monkey = prompt("What's the monkey's name?","The monkey");
// declare some short strings
var demanding = " demands - no - insists upon receiving ";
var requesting = " nicely asks for the benefit of all ";
var tech = " a computer that won't crash, and a homemade browser!";
var peace = " love for everyone and peace on earth.";
// construct some longer strings
var userRequest = "Do you want to hear what "+ monkey + " wants?"
var techy_monkey = monkey + demanding + tech;
var hippy_monkey = monkey + requesting + peace;
// make some fancy strings
var bold_tech = techy_monkey.bold();
var italic_hippy = hippy_monkey.italics();
var shouting_hippy= hippy_monkey.toUpperCase();
var red_bold_tech = bold_tech.fontcolor('red');
// stop hiding me -->
//]]>
</script>
</head>
<body>
<h1>Monkey Babbles</h1>
<script type="text/javascript">
//<![CDATA[
<!-- hide me
var monkey_love = prompt("Do you love the monkey?","Type yes or no");
if (monkey_love == "yes")
{
alert("Welcome! I'm so glad you came! Please, read on!");
var monkey_statement = prompt(userRequest,"Type yes or no");
if (monkey_statement == "yes")
document.writeln(italic_hippy + "<br>");
break;
}
else if (monkey_love == "no")
{
alert("Just giving you the heads up: the monkey hates you too");
var monkey_statement = prompt("Do you want to hear what the monkey wants?","Type yes or no");
if (monkey_statement == "yes")
document.writeln(red_bold_tech + "<br>");
break;
}
else if (monkey_love == "Type yes or no")
{
alert("Do you just randomly click on dialog boxes?");
var monkey_statement = prompt("Do you want to hear what the monkey wants?","Type yes or no");
if (monkey_statement == "yes")
document.writeln(shouting_hippy + "<br>");
else {
document.writeln("The monkey is pained by your general lack of interest")
}
break;
}
else
{
alert("You make no sense to monkey");
var monkey_statement = prompt("Do you want to hear what the monkey wants?","Type yes or no");
if (monkey_statement == "yes")
document.writeln(bold_tech + "<br>");
break;
}
// show me -->
//]]>
</script>
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
</p>
</body>
</html>
HTMLとJavaScriptはコンパイルされません。 –
javascriptコンソール(firefoxのshift-ctrl-J)を確認して、javascriptエラーを探します。 –