473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

aceess to a text using Id

Hi,
I've an html page that contains a form, inside the form Ive the folowing
input
<input name="myName" id="myId" size="40" >

I know how to access to it in javascript using its name
document.forms[0].myName

How Can I access to it using its Id?

I need this because in the case of a select, the name is an array (because I
need it in php)

Thanks.
Jul 20 '05 #1
5 1302
On Wed, 3 Mar 2004 18:04:31 -0500, toufik toufik <to*****@sympatico.ca>
wrote:
I've an html page that contains a form, inside the form Ive the folowing
input
<input name="myName" id="myId" size="40" >

I know how to access to it in javascript using its name
document.forms[0].myName

How Can I access to it using its Id?


[snip]

"hak" <s_**********@hotmail.com> also asked this question in the thread
"How can I use the id in javascript", posted Wed, 3 Mar 2004 21:04:28 GMT.

Monitor that thread instead of starting a new one.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2

"toufik toufik" <to*****@sympatico.ca> wrote in message
news:Zv********************@news20.bellglobal.com. ..
Hi,
I've an html page that contains a form, inside the form Ive the folowing
input
<input name="myName" id="myId" size="40" >

I know how to access to it in javascript using its name
document.forms[0].myName

How Can I access to it using its Id?
document.getElementById("myId")

i believe this should work for IE and Netscape. And also will work for
things other than forms.
I need this because in the case of a select, the name is an array (because I need it in php)

Thanks.

Jul 20 '05 #3
Lee
toufik toufik said:
I need this because in the case of a select, the name is an array (because I
need it in php)


http://www.jibbering.com/faq/#FAQ4_25

Jul 20 '05 #4
DU
toufik toufik wrote:
Hi,
I've an html page that contains a form, inside the form Ive the folowing
input
<input name="myName" id="myId" size="40" >

I know how to access to it in javascript using its name
document.forms[0].myName

How Can I access to it using its Id?

I need this because in the case of a select, the name is an array (because I
need it in php)

Thanks.


Are you T. Ouriachi?
If several form elements have the same name, then
document.forms[0].myName.item(index)
http://www.w3.org/TR/2000/REC-DOM-Le...ml#ID-349467F9

Best would be to avoid sharing the same name for form controls.

DU
Jul 20 '05 #5
Thanks friends,

DU; I'm not T. Ouriachi. ;-)

"DU" <dr*******@hotWIPETHISmail.com> wrote in message
news:c2**********@news.eusc.inter.net...
toufik toufik wrote:
Hi,
I've an html page that contains a form, inside the form Ive the folowing
input
<input name="myName" id="myId" size="40" >

I know how to access to it in javascript using its name
document.forms[0].myName

How Can I access to it using its Id?

I need this because in the case of a select, the name is an array (because I need it in php)

Thanks.
Are you T. Ouriachi?
If several form elements have the same name, then
document.forms[0].myName.item(index)

http://www.w3.org/TR/2000/REC-DOM-Le...ml#ID-349467F9
Best would be to avoid sharing the same name for form controls.

DU

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: pradeep gummi | last post by:
I have an XML FILE that is to be converted to Plain Text using an XSL file. Since I just want plain text, I do not want to set any root element during transformation.And if I do not any root...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
4
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
1
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS....
11
by: pardesiya | last post by:
Friends, I am having trouble displaying Japanese text within a textbox (or anywhere else) in an aspx page with .net 2.0 framework. Initial default text in Japanese displays perfectly but when I...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
0
by: chandrasekhar | last post by:
Hi I have developed a web page with some controls. I put all of them in session variables. I passed this values in the page. When an user enter some data in form fields and click the buttton ,...
2
by: Moiseszaragoza | last post by:
I am not sure if this goes in here ot the ASP forum I have been trying to get some simple AJAX on my site but its not going so well I am not sure what my problems is what i am trying to do is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.