473,465 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

assign a value to a textbox

Rob
Hello all,

I have the following code:

frm.elements.['textbox_id'].innerText='some text';

this works in the IE but not in Mozilla.

How do I fill a textbox in Mozilla?
Thanks inadvance

Rob
Jul 23 '05 #1
2 20339
Rob wrote:
Hello all,

I have the following code:

frm.elements.['textbox_id'].innerText='some text';

this works in the IE but not in Mozilla.

It won't work in IE either - get rid of the dot between 'elements' and
['textbox_id'], try:

frm.elements['textbox_id'].innerText='some text';

Mozilla does not support innerText - it's a Microsoft standard,
not a W3C standard - so even the corrected code won't work.

How do I fill a textbox in Mozilla?


Assuming from your code above you have an input element of type text
that has an id='textbox_id', you could use:

document.getElementById('textbox_id').value = 'some text';

Also assuming you do appropriate feature testing for getElementById.
If you put a name on the input: name='textbox_id', then use:

frm.elements['textbox_id'].value = 'some text';

or

frm.textbox_id.value = 'some text';

Both of which work in IE 6 as well, though to support older browsers
you'll have to do something else.

Cheers, Rob
Jul 23 '05 #2
Rob
thanks Rob, just what I needed

Rob
"RobG" <rg***@iinet.net.auau> schreef in bericht
news:B2*****************@news.optus.net.au...
Rob wrote:
Hello all,

I have the following code:

frm.elements.['textbox_id'].innerText='some text';

this works in the IE but not in Mozilla.


It won't work in IE either - get rid of the dot between 'elements' and
['textbox_id'], try:

frm.elements['textbox_id'].innerText='some text';

Mozilla does not support innerText - it's a Microsoft standard,
not a W3C standard - so even the corrected code won't work.

How do I fill a textbox in Mozilla?


Assuming from your code above you have an input element of type text
that has an id='textbox_id', you could use:

document.getElementById('textbox_id').value = 'some text';

Also assuming you do appropriate feature testing for getElementById.
If you put a name on the input: name='textbox_id', then use:

frm.elements['textbox_id'].value = 'some text';

or

frm.textbox_id.value = 'some text';

Both of which work in IE 6 as well, though to support older browsers
you'll have to do something else.

Cheers, Rob

Jul 23 '05 #3

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

Similar topics

2
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New...
2
by: Grey | last post by:
I want to assign a value to HMTL textbox with id "txtABC" in ASP.NET with C#
1
by: Shilpi Chaudhry | last post by:
I have a forloop which I use to create textboxes - but unfortunately all of them have the same ids - I need to assign different ids to these textboxes creeated in the loop so that I can retrieve...
8
by: Sergei | last post by:
Hi, I am displaying modal dialog and passing values from the main form to the modal dialog and back. It works fine but if I used the following syntax on Page_Load(just for testing) in VB to...
15
by: Swetha | last post by:
Hello I have a DropDownList that I am populating using the following SqlDataSource: <asp:DropDownList ID="parentIDDropDownList" runat="server" DataSourceID="SqlDataSource3"...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
2
by: rachit.goyal | last post by:
Hi All, I am using .net first time.In my windows form VC7 application, on a click of button, I am assigning text of TextBox to STL string varibale. Using this code- private: System::Void...
1
by: Nathan Sokalski | last post by:
I have a form that is being used to edit account information. The form contains username and password TextBoxes, for which I set Enabled=False. When I assign the Text property the previous value,...
5
by: lianping | last post by:
Hi, I have a problem to assign a value into text box, below will be my script. Before view my script, let me hv quick explain on what is my problem: I would like to assign Java script value...
5
by: =?Utf-8?B?ZWdzZGFy?= | last post by:
I had to create a HTML textbox to add the date time but I don't know how to assign the value with asp.net, how can I do that? This is my HTM Textbox code: <input id="txtFechaPlan"...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.