473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create input element with name or change an input element's name?

2 New Member
I need to dynamic create input element in some cases, and I use javascript to do that, like the following code:
Expand|Select|Wrap|Line Numbers
  1. ....
  2. var inputElement = document.createElement("input");
  3. this.inputElement.name= "fieldName";
  4. this.inputElement.type = "text";
  5. this.inputElement.value = "somevalue";
  6. ....
  7.  
and in some other place, I need to use JavaScript to access the value,
like :
document.forms[0]['fieldName'].value

The code works fine in FireFox,
but in IE(6), I found that the name of the inputElement is gone.
So I wrote some other script to change input element's name,
It still not work( but works in FireFox).
I have a input element in form, and use a button to trigger the following function
Expand|Select|Wrap|Line Numbers
  1. function create()
  2. {
  3.     alert("abc:" + document.forms[0]['abc'].value );
  4.     document.forms[0]['abc'].setAttribute("name", "def");
  5.     alert("def:" + document.forms[0]['def'] );
  6. }
  7.  
in FireFox, the name is changed, but in IE, the name is not changed, and 'def' is not exist in the form.

Are there any one know what's going on?
Dec 12 '07 #1
3 2274
gits
5,390 Recognized Expert Moderator Expert
hi ...

have a look at the links in this post ... it covers exactly your problem ;)

kind regards
Dec 12 '07 #2
vincentshiu
2 New Member
Thanks a lot. you really do me a big favor~~
Dec 13 '07 #3
gits
5,390 Recognized Expert Moderator Expert
no problem ... post back to the forum in case you have more questions :)

kind regards
Dec 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2181
by: Adam Retter | last post by:
Hi Guys, I have a need to create a html form based on my schema. I initially decided to do this using xql, have got some way but am finding this difficult (it may be as I am very new to xql). The html form needs to be dynamically generated from the schema as the schema may change in future. We need the forms to provide a UI for users to edit the underlying xml documents represented by the schema. Im wandering if there is an easy way...
8
1524
by: Michael Hill | last post by:
I have this input element: <input type='text' name='street' maxlength='20' size='20'> that I only want the user to be able to input to based on a item from a select list: <select name='street_sel' size='1' onchange='ck_street();'> <option value='abc'>abc</option> <option value='def'>abc</option> <option value='unk'>street not in list</option> </select>
1
2179
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not work. It works if the tags are <input type=radio...>. This line is OK:
3
9145
by: takarimasu | last post by:
How can i create an input object (text area,select) at runtime ? B.
0
1641
by: Dhananjayan | last post by:
Hi, I have a webservice(eg.IStringServicePort) running on Axis, iam able to create a java client for the same and invoke the service and obtain the result. I wanted to create a .Net client(C#) for the same..For that I did the following thing I added a web reference for the service thru "Add Web Reference", It got added successfully, But iam unable to find the web reference in my c# class. Because of that iam not able to invoke the...
3
2200
by: Dhananjayan | last post by:
Hi, I have a java webservice running on Axis, Iam able to create a java client to invoke the webservice and obtain the result. But iam not able to invoke the service from .Net client.. Here are the steps i followed to create a .net client I created a web reference("NetClient") for a webservice running in Axis thru "Add Web Reference", it created succesfully. The next step I should do in order to invoke the service is to
0
1800
by: DotDidIt | last post by:
Hi Everybody! I developed a Web service with IBM RAD v 6.0.1. After creating the WSDL file i have tried to develop a .Net client. But by using wsdl.exe (1.1.4322) to create a .net c# proxy i get the following error message: Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com' is not available to be referenced in this schema. Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com'
2
1724
by: Mukesh | last post by:
Hi all I m Using SQL SERVER 2005 I have a requirement to store some data in xmldatatype using stored procedure , Here is example
14
5192
RMWChaos
by: RMWChaos | last post by:
Firebug is reporting "too much recursion" when I attempt to create a child element in a parent that doesn't exist yet. The script should automatically create the missing parent before going on to create the child element. At the point where the script is supposed to call itself with the new properties to create the parent, it gives me the error and looks like it's looping the function continuously. It seems that "id : attrib" (line 192) is...
0
9297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5168
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5324
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3828
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 we have to send another system
3
2697
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.