87,907
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>MyXhtml.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="example.js">
</script>
</head>
<body>
<h1>SnapShots</h1>
<ul>
<li>
<a href = "images/1.jpg" title = "1" onclick = "showPic(this); return false;">1</a>
</li>
<li>
<a href = "images/2.jpg" title = "2" onclick = "showPic(this); return false;">2</a>
</li>
<li>
<a href = "images/3.jpg" title = "3" onclick = "showPic(this); return false;">3</a>
</li>
</ul>
<p id = "description">choose an image</p>
<img id="placeholder" src = "images/3.jpg" alt="my image gallery"/>
</body>
</html>
for(var propName in window) {
document.write(proName);
document.write("<br/>");
}
function showPic(whichpic) {
var source = whichpic.getAttribute("href");
var placeholder = document.getElementById("placeholder");
placeholder.setAttribute("src", source);
var text = whichpic.getAttribute("title");
var description = document.getElementById("description");
description.lastChild.nodeValue = text;
}
function countBodyChildren() {
var body_element = document.getElementsByTagName("body")
[0];
alert(body_element.childNodes.nodeType);
alert(body_element.nodeType);
}
window.onload = countBodyChildren;
function sum(num1, num2) {
return num1 + num2;
}
alert(sum(10, 10));
var anothersum = sum;
alert(anothersum(10,10));
sum = null;
alert(anothersum(10, 10));
alert(sum(10, 10));
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>MyXhtml.xhtml</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
.........
</body>
<script type="text/javascript" src="example.js"></script>
</html>