Current location: Hot Scripts Forums » General Web Coding » JavaScript » Accessing Forms Which have no FORMS set

Accessing Forms Which have no FORMS set

Reply
  #1 (permalink)  
Old 09-05-07, 10:10 PM
desdev desdev is offline
New Member
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Accessing Forms Which have no FORMS set

Hi everyone,

I have come up against a brick wall at the moment. When you have a form with submit buttons and text fields i know using javascript you can access these elements, but you require the name of the form to be set.

Is there any way to do this when the form has no name set!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-06-07, 05:50 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community VIP
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 2,724
Thanks: 0
Thanked 0 Times in 0 Posts
use the document.getElementById method to access the elements. You will have to give all elements an id first though

a Javascript example:
Javascript Code:
  1. document.getElementById('my_element').value = 'hello';
the html element:
HTML Code:
<input type="text" id="my_element" />
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

If you want to add me on any IM, pm me first
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-08-07, 08:44 PM
TwoD TwoD is offline
Community Liaison
 
Join Date: Sep 2003
Location: 404
Posts: 1,811
Thanks: 0
Thanked 0 Times in 0 Posts
Btw, I suggest putting the same id and name on each form element. It makes it a bit less confusing, especially if you're also running serverside form processing.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
GRRR!!!! ERror help please! stormshadow PHP 4 12-06-06 09:05 PM
php timer that executes an action after a set interval zmbz PHP 3 02-10-06 07:15 AM
ASP upload prob minority ASP 1 06-27-05 09:35 AM
NEW Flash Tutorials from CheapDemos.com! Set your hosting company apart! Puenil General Advertisements 0 04-27-05 10:52 PM
Setting a cooke (time it expires) mcrob PHP 4 04-27-05 01:13 PM


All times are GMT -5. The time now is 08:21 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.