Same Document | document.write("<h1>Title</h1>"); | |
Different Frame | parent.frame_name.document.write("<h1>Title</h1>"); | |
New Window | newWin = window.open("",
"", "height=320,width=175");
newWin.document.write("<h1>Title</h1>"); |
Methods or Attribute | HTML | JavaScript | |
---|---|---|---|
Open a document | document.open() | ||
Write HTML | document.write("HMTL") | ||
Write HTML followed by new line | document.writeln("HMTL") | ||
Clean the document | document.clear("HMTL") | ||
Close the document | document.close("HMTL") | ||
Set color of active links | alink=#rrggbb | document.alinkColor="rrggbb" | |
Set color of background | bgcolor=#rrggbb | document.bgColor="rrggbb" | |
Set color of text | text=#rrggbb | document.fgColor="rrggbb" | |
Set color of unvisited links | link=#rrggbb | document.linkColor="rrggbb" | |
Set color of visited links | vlink=#rrggbb | document.vlinkColor="rrggbb" | |
Get an anchor | = document.anchors[0] | (v1.1) | |
Length of anchors array | = document.anchors.length | (v1.1) | |
Get an applet | = document.applets[0] | (v1.1) | |
Length of applets array | = document.applets.length | (v1.1) | |
Get an embed | = document.embeds[0] | (v1.1) | |
Length of embeds array | = document.embeds.length | (v1.1) | |
Get an image | = document.images[0] | (v1.1) | |
Length of images array | = document.images.length | (v1.1) | |
Sets the documents title | <title>Title</title> | document.title="Title" | |
Get domain of document | = document.domain | (v1.1) | |
Get the URL of the current document | = document.location | ||
Get the URL of the document the calling document | = document.referrer | ||
Get the width of the current docuement | = document.width | * | |
Get the height of the current document | = document.height | * |
* | document.width & docuement.height seam to work when used for comparison (see layers.htm). The values display intermittantly with Netscape 4.73 and Mozilla. Appears to be very handy, but very risky. |
document.anchors.length | = | (IE, NS, Mo) | |
document.applets.length | = | (IE, NS, Mo) | |
document.embeds.length | = | (IE, NS, Mo) | |
document.images.length | = | (IE, NS, Mo) | |
document.domain | = | (IE, NS, Mo) | |
document.location | = | (IE, NS, Mo) | |
document.referrer | = | (IE, NS, Mo) | |
document.width | = | (Questionable NS, Mo - not IE) | |
document.height | = | (Questionable NS, Mo - not IE) |
Attribute | JavaScript | Curent Value | Browser Support |
---|---|---|---|
Usable height | = screen.availHeight | IE, NS, Mo | |
Usable width | = screen.availWidth | IE, NS, Mo | |
Total height | = screen.height | IE, NS, Mo | |
Total width | = screen.width | IE, NS, Mo | |
bits/pixel | = screen.pixelDepth | NS, Mo | |
bits/pixel * | = screen.colorDepth | IE, NS-W, Mo |
* | Dynamic HTML Unleashed describes this as the number of colors. But, that's not whats returned by the browsers. |
Last Updated: $Date: 2002/02/20 05:48:29 $ GMT ($Revision: 1.5 $)