LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-29-2010, 07:07 PM   #1
action_owl
Member
 
Registered: Jan 2009
Location: 127.0.0.1
Distribution: Fedora, CentOS, NetBSD
Posts: 115

Rep: Reputation: 17
[SOLVED] Access HTML elements via Javascript with internal ID


Is there some way to access HTML elements via javascript through some internal ID?

For instance, given a form like:

Code:
<form name="myForm">
  <input type="text" />
  <input type="text" />
  <input type="text" />
</form>
Can I do something like:

Code:
var first = document.myForm.input[0];
first.value = "First Input Box";
I think I've seen some way to do this before but I'm not certain

Last edited by action_owl; 03-29-2010 at 08:42 PM.
 
Old 03-29-2010, 08:26 PM   #2
sunnydrake
Member
 
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 41
<a id="idname">

document.getElementById("idname")
//
getElementsByTagName ..etc..

rtfm W3C.

Last edited by sunnydrake; 03-29-2010 at 08:27 PM.
 
Old 03-29-2010, 08:37 PM   #3
action_owl
Member
 
Registered: Jan 2009
Location: 127.0.0.1
Distribution: Fedora, CentOS, NetBSD
Posts: 115

Original Poster
Rep: Reputation: 17
Quote:
rtfm W3C.
Actually I just found DOM 0, and thats what I needed, not access via 'id' so read the f'in post before you tell someone to rtfm
 
Old 04-02-2010, 02:45 AM   #4
sunnydrake
Member
 
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 41
ungrateful and impatient... as i see you lack knowledge of structure and terminology. that why i send you to W3C as this org have proper documents describing html/jscript architecture and terminology. Also read your post first and understand that you used term internal ID. id is a property of html element!. Your behavior will not let you succeed in getting help at least from me now on.
 
Old 04-02-2010, 10:39 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,803

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
Both of you please tone it down.........
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML/Javascript - Can I access a user's local SQL server (with their permission) fcdev Programming 5 09-07-2009 04:08 AM
javascript - having a problem recusively visiting elements... BrianK Programming 3 10-22-2007 02:22 PM
LXer: Finaly we get new elements in HTML 5 LXer Syndicated Linux News 0 08-09-2007 05:16 PM
html form - order of returned elements rblampain Programming 2 04-26-2007 08:13 AM
accessing forms elements with javascript djgerbavore Programming 2 06-03-2005 03:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration