我通過一些javascript例子的工作,我只是做了這樣一個:如何思考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 http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Page title</title>
<script type="text/javascript">
function displayText()
{
document.getElementById('targetDIV').innerHTML = "You're using Javascript";
}
</script>
</head>
<body onload="displayText()">
<h2>This should be before the other text.</h2>
<div id="targetDIV">
</div>
</body>
</html>
確定。我知道很基本,但我意識到我對某些事情的「爲什麼」感到困惑。準確地說:
函數= 什麼會發生。
呼叫(身上onload ...)= 當它會發生。
和DIV ID =「targetDIV」 = WHERE它會發生
我知道這是在這個例子中的情況,但總體上,事情的方式在Javascript中工作?
我不得不說這是一個令人驚訝的抽象方式。 – 2010-01-23 07:38:38
-1?來吧..........發生了什麼事? – 2012-09-20 06:43:18