Changes

JavaScript Document Object

685 bytes added, 20:31, 14 May 2007
Writing text to a document
This is a line of text specified in the HTML file
This is a line of text written to the document using JavaScript
</pre>
 
=== Changing the Document Title ===
 
Even when the title of a document has been specified using the HTML ''<title>'' tag it is possible to dynamically change the current setting using the ''title'' property of the document object. The following example intially sets the document title to ''JavaScript Document Object Example'' and provides a button which, when pressed, change sthe title to a new value:
 
<pre>
 
<html>
<head>
<title>JavaScript Document Object Example</title>
</head>
<body>
<p>
This is a line of text specified in the HTML file
</p>
<form action="">
<input type=button value="Press to change title" onclick="document.title='hello'"/>
</form>
</body>
</html>
 
</pre>