473,883 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to explicit reference an attribute?

Hi
I have made a mistake, and have named an input object the same as a form
attribute, i now want to change with some jscript. I don't want to change
all my codepages, so i need to address the attribute explicitly.
Some pseudo code will ilustrate what i did wrong:
<form name=myForm id=myForm.....>
<input type=submit name=action id=action....>
My problem is, that when i try to execute document.myForm .action='xxx.ht m' i
refference the submit object i myForm instead.

Can anybody please tell me how i reference the action attribute in the form
object instead?

Thank you in adwance
Jens
Jul 23 '05 #1
4 1311
Jens wrote:
Hi
I have made a mistake, and have named an input object the same as a form attribute, i now want to change with some jscript. I don't want to change all my codepages, so i need to address the attribute explicitly.
Some pseudo code will ilustrate what i did wrong:
<form name=myForm id=myForm.....>
<input type=submit name=action id=action....>
My problem is, that when i try to execute document.myForm .action='xxx.ht m' i refference the submit object i myForm instead.

Can anybody please tell me how i reference the action attribute in the form object instead?

Thank you in adwance
Jens


I don't believe there's a workaround for this - in IE, anyway.

document.getEle mentById('myFor m').get[set]Attribute('acti on'[,'xxx.htm'])

....seems to work elsewhere, but not there. Possibly an issue with the
form's scope chain that masks the attribute with the element (object).
IE does some strange things with non-form elements embedded inside a
form as well.

Probably best to bite the bullet & fix your files. Could be mistaken...

Jul 23 '05 #2
On Wed, 09 Mar 2005 20:29:24 +0100, Jens wrote:
Hi
I have made a mistake, and have named an input object the same as a form
attribute, i now want to change with some jscript. I don't want to
change all my codepages, so i need to address the attribute explicitly.
Some pseudo code will ilustrate what i did wrong: <form name=myForm
id=myForm.....>
<input type=submit name=action id=action....> My problem is, that when i
try to execute document.myForm .action='xxx.ht m' i refference the submit
object i myForm instead.

Can anybody please tell me how i reference the action attribute in the
form object instead?


Since action is an attribute of a form I'm guessing you can't use "action"
no matter how you reference it. None the less, you need to change your
code. That's going to be a fun search and replace.

--
Life is short, but wide. -KV

Jul 23 '05 #3
I think i found an ansver myself.
If referenced like this document.myForm .attributes['action'].value='xxx.htm '
i get the wantet result. Tested with IE6 and NS7.
Also, if the input object is named ACTION in uppercase, wich is easy to
change in my code, it seems the right attribute will be referenced.

Comments and sugestions are welcome.

/Jens
"Jens" <je**@REMOVETHI S.blicher-schroeder.dk> wrote in message
news:42******** *************** @dread14.news.t ele.dk...
Hi
I have made a mistake, and have named an input object the same as a form
attribute, i now want to change with some jscript. I don't want to change
all my codepages, so i need to address the attribute explicitly.
Some pseudo code will ilustrate what i did wrong:
<form name=myForm id=myForm.....>
<input type=submit name=action id=action....>
My problem is, that when i try to execute document.myForm .action='xxx.ht m' i refference the submit object i myForm instead.

Can anybody please tell me how i reference the action attribute in the form object instead?

Thank you in adwance
Jens

Jul 23 '05 #4
Jens wrote:
If referenced like this
document.myForm .attributes['action'].value='xxx.htm ' i get the wantet
result. Tested with IE6 and NS7.
Also, if the input object is named ACTION in uppercase, wich is easy
to change in my code, it seems the right attribute will be referenced.


The "attributes " collection was introduced in DOM Level 1, so if you
want to support some old browsers like NN4, and you can easily change
your code to use an upper case form control's name, you should do so.
If you don't have to care for old browsers, choose the first variant.

ciao, dhgm
Jul 23 '05 #5

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

Similar topics

3
2074
by: Pablo Gomes Ludermir | last post by:
Hello, I have the following case that I am trying to put in XML Schema. I have the classes HelpItem, Document and Message that work as follows: One HelpItem contains several Document and Message instances. Thus, in XML Document and Message are child elements of HelpItem. However, a Message may have a reference to one or several existing Docuemnt instances, and also may have a reference to one or several
4
5876
by: Jean Stax | last post by:
Hi ! I tried to understand when the explicit attribute in copy constructor prevents from me to create a new object. Bellow is the sample code. While the two first cases really generate a compilation error, the third (mc2 = Foo1();) compiles and runs without any problem. I am wondering why the: MyClass Foo1()
4
1852
by: CoolPint | last post by:
I would be grateful if someone could point out if I am understanding correctly and suggest ways to improve. Sorry for the long message and I hope you will kindly bear with it. I have to make it elaborate to make sure my questions are clear enough. Let's say I need to write a function whose logic is same for all types (T) except in the case of T * (including const T *). Furtheremore , the function needs to be written differently for...
9
2384
by: Tanmoy Bhattacharya | last post by:
Hi, This is a question about whether I am right that a particular syntactic sugar is missing in C++. Let me explain with an example. Let us say I have a class for complex numbers, and I want people to be able to initialize real numbers (like an object of type double) from it ... in such a context (or if someone explicitly casts to double), the imaginary part is to be ignored. However, I certainly do not want people to be able to ask...
2
2150
by: Dave | last post by:
Hello NG, Can anybody fathom the purpose of an explicit copy constructor? On page 232 of the Josuttis STL reference, I see a reference to such. How could you ever need to supress the possibility of an implicit conversion from type T to type T? Such an implicit conversion could never occur because you're already of the required type! Thanks,
4
1614
by: Tony Johansson | last post by:
Hello experts! I have read in a book that say once a reference attribute has been assigned a value, it cannot be changed but this is wrong I think because I can change a reference attribute see the program below. Now to my question have you any comment about this sentence once a reference attribute has been assigned a value, it cannot be changed. Is it just completely wrong or? #include <string>
4
13911
by: Chua Wen Ching | last post by:
Hi there, I had a union in C: typedef union TagMessage { struct { unsigned char avalue; unsigned char bvalue; } a;
31
3642
by: Michael C | last post by:
If a class inherits from another class, say Form inherits from control, then I can assign the Form to a variable of type Control without needing an explicit conversion, eg Form1 f = new Form1(); Control c = f; An enum value inherits from int but it doesn't get implicitly converted: HorizontalAlignment h = HorizontalAlignment.Center;
9
1551
by: D.J. Stachniak | last post by:
Hi, I have a question about explicit constructors and the C++ standard. Forgive me for my laziness in not pouring over the spec myself, but I thought I'd ask first and read later. I have a class/app like so: #include <string> #include <iostream> class UTF8string
0
9938
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9791
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
10742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9572
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7971
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
5797
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
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4611
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
2
4218
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.