please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

Element.value Property

Name

Element.value Property---value displayed or submitted by a form element

Availability

Navigator 2.0, buggy in Internet Explorer 3.0

Synopsis

element.value

Description

value is a read/write string property of all form elements. It specifies the value that is displayed by the form element and/or submitted for the element when the form is submitted. The value property of the Text element, for example, is the user's input, which is also the value submitted with the form. For the Checkbox object, on the other hand, the value property specifies a string that is not displayed, but which will be submitted with the form if the Checkbox element is checked when the form is submitted.

The initial value of the value property is specified by the VALUE attribute of the HTML tag that defines the form element.

For Button, Submit, and Reset objects, the value property specifies the text to appear within the button. On some platforms, changing the value property of these elements will actually change the text displayed by the buttons on-screen. This does not work on all platforms, however, and is not an advisable technique because changing the label of a button may change the size of the button, and cause it to overlap and obscure other portions of the document.

The Select element has a value property, like all form elements, but does not use it. Instead, the value submitted by this element is specified by the value property of the Option objects it contains.

In Navigator 2.0 and Internet Explorer 3.0, the value property of the Password object is nonfunctional for security purposes. It can be read and written, but this has no bearing on the value entered by the user, or submitted with the form. In Navigator 3.0, when the data-tainting security model is enabled, the value property does actually contain the user's input to this element.

A limitation of Internet Explorer 3.0 only allows strings to be assigned to the value property of HTML form elements. If you want to assign objects to this property, you must explicitly convert them to strings by, for example, adding the empty string to them. Thus, to display the current date and time in a text field, Internet Explorer would require code like this:

var today =index.html new Date();
document.forms[0].elements[1].value = "" + today;

Bugs

Internet Explorer 3.0 does not automatically convert objects to strings when they are assigned to this property; you must explicitly perform that conversion yourself.

See Also

"Element", "Element.name"


Previous Home Next
Element.type Book Index Embed

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell

file: /Techref/language/java/script/definitive/refp_115.htm, 6KB, , updated: 2019/10/14 15:00, local time: 2024/11/8 10:23,
TOP NEW HELP FIND: 
3.15.34.244:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/Techref/language/java/script/definitive/refp_115.htm"> [Chapter 21] Reference: Element.value</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?