Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Code Snippets - JavaScript

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Mon, Aug 29, 2011, 8:49 AM


{outline||<1> - }

Displaying the current URL

The following javascript will output the URL of the page in which the javascript is running.

document.write(document.URL);

Displaying the Document Timestamp

The following JavaScript code will output when the document was last updated.

document.write(document.lastModified);

Setting Initial Focus

To set the control with the initial focus on a web page, perform the following steps.

  • Browse to the page.
  • View the HTML source for the page and find the ID of the control of interest
  • Place the following code near the BOTTOM of the body of the page, changing "myControlId" appropriately.

document.getElementById("myControlId").focus();

Submitting a Form

document.forms[0].submit();

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.