wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Javascript and Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript and "value=" attribute of input tag." Watch "Javascript and "value=" attribute of input tag." New topic
Author

Javascript and "value=" attribute of input tag.

Gabriel Allen
Greenhorn

Joined: Jan 09, 2007
Posts: 12
Is there anyway to use a javascript value in the value attribute of an input tag?

Ex:
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
you can set the value with JavaScript with some sort of action



Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

I prefer to avoid references such as forms[0] because the code may break if the form changes position on the page.

Give the form an explicit name and use it, or give the element an id and reference it directly.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by Bear Bibeault:
I prefer to avoid references such as forms[0] because the code may break if the form changes position on the page.

Give the form an explicit name and use it, or give the element an id and reference it directly.


Bear,

You use more than one form on a page? Geesh...lol

FYI: name is depretiated now on a form element if you care about standards!

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript and "value=" attribute of input tag.
 
Similar Threads
having problems with javascript
h:commandLink Alternative
which button is clicked
Use Value of Another Tag in Onclick Event
Process Custom tag based on the given input from html (same page)