<SCRIPT language="JavaScript">
<!--
document.alinkColor="#FF0000";
//-->
</SCRIPT>
<body alink="red">
<h1>My Super Duper Web Page</h1>
<SCRIPT language="JavaScript">
<!--
document.write("The active link color here is " + document.alinkColor);
//-->
</SCRIPT>
<P>
<A HREF="bgcolor.htm">Try a link
</body>
<h2><a id="books" name="books"></a>Textbook</h2>
<pre>
<a href="http://www.pageresource.com/jsbook.html">JavaScript: A Beginner's Guide</a>,
by John Pollock,
McGraw-Hill, 2001.</pre>
<hr />
<h3><a name="refs"></a>On-line References</h3>
<ul>
<li><a href="http://prog.knu.edu.tw/sylee/courses/webprog/"
target="_parent">Course Home Page</a></li>
<li><a href="http://www.pageresource.com/jscript/">Pageresource Javascript</a></li>
<li><a href="http://www.wsabstract/">Javascript Scripts</a></li>
<li><a href="http://www.javascriptcity.com/java/">Javascript Forums</a></li>
</ul>
<hr />
<h3><a name="instr"></a>Instructor: <a href="http://prog.knu.edu.tw/sylee/"
target="_parent">Prof. S. Y. Lee</a></h3>
<hr />
<SCRIPT language="JavaScript">
<!--
document.write("There are " + document.anchors.length() + " named anchors.");
//-->
</SCRIPT>
<head>
<SCRIPT language="JavaScript">
<!--
document.bgColor="lightblue";
//-->
</SCRIPT>
</head>
<body bgColor="yellow">
<h1>My Super Duper Web Page</h1>
<SCRIPT language="JavaScript">
<!--
document.write("The background color here is " + document.bgColor);
//-->
</SCRIPT>
</body>
<body bgColor="red" text="white">
<h1>My Super Duper Web Page</h1>
<B>Want a new background color? Change it to light blue by clicking the button below!</B>
<form>
<input type="button" value="Click"
onClick="document.bgColor='lightblue';">
</form>
</body>
示範: background 1 <html>
<head>
<title>Background Colors</title>
<SCRIPT language="JavaScript">
<!--
function newbg(thecolor)
{
document.bgColor=thecolor;
}
//-->
</SCRIPT>
</head>
<body bgColor="yellow">
<B>Want a new background color? Change the color by clicking the button below!</B>
<form>
<input type="button" value="淺藍" onClick="newbg('lightblue');">
<input type="button" value="橘黃" onClick="newbg('orange');">
<input type="button" value="米黃" onClick="newbg('beige');">
<input type="button" value="黃" onClick="newbg('yellow');">
</form>
</body>
</html>
示範: background 2
<head>
<SCRIPT language="JavaScript">
<!--
document.fgColor="blue";
//-->
</SCRIPT>
</head>
<body text="blue">
<h1>My Super Duper Web Page</h1>
<SCRIPT language="JavaScript">
<!--
document.write("The text color here is " + document.fgColor);
//-->
</SCRIPT>
</body>
<body>
<h2>Forms and Names</h2>
<form name="for">
<input type="button" name="but" value="You can click me I suppose"
onClick="document.for.but='Thanks for clicked me!';">
</form>
</body>
<html>
<head>
<SCRIPT language="JavaScript">
<!--
if (document.images)
{
var myimage=new Image(123,164);
myimage.src="sy.jpg";
}
//-->
</SCRIPT>
</head>
lastModified 屬性
<body>
<h2>Last Modified Date</h2>
document.write("Last modified: " + document.lastModified);
</body>
layers 屬性(陣列)
<SCRIPT language="JavaScript">
<!--
if (document.layers)
{
window.alert("You have Netscape Navigator 4 or better");
}
//-->
</SCRIPT>
all 屬性
<SCRIPT language="JavaScript">
<!--
if (document.all)
{
window.alert("You have Internet Explorer 4 or better");
}
//-->
</SCRIPT>
linkColor 屬性
<SCRIPT language="JavaScript">
<!--
document.linkColor="#0000FF";
//-->
</SCRIPT>
<body alink="red" link="blue">
<h1>My Super Duper Web Page</h1>
<SCRIPT language="JavaScript">
<!--
document.write("The link color here is " + document.linkColor);
document.write("The active link color here is " + document.alinkColor);
//-->
</SCRIPT>
<P>
<A HREF="bgcolor.htm">Try a link
</body>
links 屬性(陣列)
plugins 屬性(陣列)
referrer 屬性
<SCRIPT language="JavaScript">
<!--
document.write("You came from " + document.referrer + "!");
//-->
</SCRIPT>
title 屬性
<html>
<head>
<title>Introduction to Web Programming</title>
</head>
<body>
<SCRIPT language="JavaScript">
<!--
document.write("<H1>" + document.title + "</H1>");
//-->
</SCRIPT>
<h2 align="center">Spring 2003</h2>
</body>
示範: title
URL 屬性
<html>
<head>
<title>Introduction to Web Programming</title>
</head>
<body>
<SCRIPT language="JavaScript">
<!--
document.write("<H1>" + document.title + "</H1>");
//-->
</SCRIPT>
<h2 align="center">Spring 2003</h2>
<SCRIPT language="JavaScript">
<!--
document.write("You are at: " + document.URL + ".");
//-->
</SCRIPT>
</body>
示範: URL
vlinkColor 屬性