Webmaster Cash Program
 Upload & Sell Your Software
Upload & Sell Your Ebook
 Enter The AWT Service Center  Contact Applied Web Tools
 Purchase Some Advertising  Password Troubles? Click Here!
Knowledge Center
Want to write for Applied Web Tools? Send your Writer's Query to
Editor@AppliedWebTools.net for details.
HTML
Reference
&
Tutorial
CSS
Reference
&
Tutorial
DOM
Reference
&
Tutorial
JavaScript
Reference
&
Tutorial
50+ Programming Examples
Use HTML, CSS, DOM & JavaScript Together
Misc. Essays & Documents
You'll Find Just About Anything In Here
50+ Web Page Constructions
Learn the Art of Using HTML, CSS, DOM & JavaScript Together
 Changing Background Colors
 Event Triggering With onLoad
 Disabling The Right Click
 DOM Driven Color Changing
 Switching Images
 innerHTML Attribute Access
 Change With innerHTML
 Changing Positions
 Change Position With onMouseMove
 Change Text Position
 Interactivity Skills
 Type-writing A Message
 Auto-changing Text Size
 Making Text Scroll
 Blinking Text
 Simple Form Authentication
 Change Background Color Of An INPUT
 Change Text Color Of An INPUT
 Change Background Image Of An INPUT
 Select All Checkboxes
 Select Color Of The Submit Button
 Change Text Color Of A Submit Button
 Insert Background Image To A Button
 Change Color Of Drop Down List
 Change Text Color Of A Drop Down List
 Change Color Of A TEXTAREA
 Change The Text Color Of A TEXTAREA
 Insert An Image Into A TEXTAREA
 Change The Size Of An Image
 Change The Source Of An Image
 Change The Position Of An Image
 Change The Background Image
 Moving Images Around The Page
 Drag & Drop An Image
 A Simple Image Viewer
 A Shaking Image
 A Digital Clock
 Drop Down List Link
 Top Drop Down Menu
 Always On Top Menu
 Inset Border Buttons
 A Description Generating Menu
 An Image Generating Menu
 A Horizontal Sliding Menu
 A Click Horizontal Sliding Menu
 Returning Cursor Co-ordinates
 Making Text Follow The Cursor
 Attaching An Image To The Cursor
change position

Before we get into the use of the style.postion statement, you must understand how the two options of this statement differ. You would usually use them with ilayer tags to accomplish a drop down menu. Each has its pros and cons and each has a very particular way they must be used.

The first option is absolute. The absolute positioned document element is positioned according to a position the browser calculates in relation to the top left corner of the document. It is expressed in pixels. The element assigned to this positioning schema will stay in the position given even if the rest of the document resizes or shifts as the browser window is resized. For example, if you absolutely positioned a centered table in your document and the user resized the window, that portion of the table that is absolutely referenced will stay where it is – the rest of the document will move. If you’d like to use this positioning technique, you must, for practical reasons, position your page justified left, valign=top. This is because the document is positioned absolutely according the top left corner of the document. If the browser window is resized, the page doesn’t move and the absolutely positioned element will have the same referenced location in the document.

The relatively positioned page element is by far the most useful. It is usually applied as a position in a table. The position is referenced as a point positioned absolutely, but in reference to the upper left corner of the area of the document specified by the TD tag. If the page is resized, the TD tag will move, but the content attached to the upper left corner of that tag will adjust as the TD tag adjusts, keeping the structure of the table intact. A browser resize, then, will move the entire table including the relatively positioned portion given as content within the table.

<html>
<head>

<script type="text/javascript">
function moveleft() {
document.getElementById('header').style.position="absolute";
document.getElementById('header').style.left="0";
}

function moveback() {
document.getElementById('header').style.position="relative";
}
</script>

</head>

<body>

<h1 id="header" onmouseover="moveleft()" onmouseout="moveback()">Mouse over this text</h1>

</body>
</html>


Notice that the style.left attribute was stated as the second statement within the JavaScript function. This is the value, in pixels, that the browser will use to position the content. Notice also that you don’t have to use the style.left attribute if you’re positioning relatively.
Want a copy of the Applied Web Tools Knowledge Center on your site?

Over 1200 individual command definitions in a really cool interface

Send your query to Sales@AppliedWebTools.net for details
I do not employ cookies or tracking devices of any kind