473,396 Members | 1,792 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,396 software developers and data experts.

Name an object

How do I create and refer to an object as the following isn't recognised,
where as if I replace myfield with LinkLocation4536, it recognises the field
in form List
function confirmDelete(wid)
{

var myfield="LinkLocation" + wid

alert(document.forms["List"].myfield.value);

}


Jun 7 '07 #1
4 1378
Paul wrote:
How do I create and refer to an object as the following isn't recognised,
where as if I replace myfield with LinkLocation4536, it recognises the
field in form List
function confirmDelete(wid)
{

var myfield="LinkLocation" + wid

alert(document.forms["List"].myfield.value);

}
Hi,

document.forms["List"].myfield.value will just fetch the value of a
formelement named myfield. Which is not what you want.

Does the following code work?

function confirmDelete(wid)
{
alert ("wid="+wid);
var myfield="LinkLocation" + wid
alert(document.forms["List"][myfield].value);
}

Regards,
Erwin Moller
Jun 7 '07 #2

"Erwin Moller"
<si******************************************@spam yourself.comwrote in
message news:46*********************@news.xs4all.nl...
Paul wrote:
How do I create and refer to an object as the following isn't recognised,
where as if I replace myfield with LinkLocation4536, it recognises the
field in form List
function confirmDelete(wid)
{

var myfield="LinkLocation" + wid

alert(document.forms["List"].myfield.value);

}
Hi,

document.forms["List"].myfield.value will just fetch the value of a
formelement named myfield. Which is not what you want.

Does the following code work?

function confirmDelete(wid)
{
alert ("wid="+wid);
var myfield="LinkLocation" + wid
alert(document.forms["List"][myfield].value);
}

Regards,
Erwin Moller

Hi

No that comes up with an expected identifier error but...............

alert (eval ("document.forms['List'].LiveLinkLocation" + wid + ".value") );

does

Cheers

Paul
Jun 7 '07 #3
Paul wrote:
alert (eval ("document.forms['List'].LiveLinkLocation" + wid + ".value") );
http://jibbering.com/faq/#FAQ4_40

function confimDelete(wid)
{
alert(document.forms['List'].elements['ListLocation' + wid].value);
}

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 7 '07 #4

"-Lost" <ma****************@techie.comwrote in message
news:M-******************************@comcast.com...
Paul wrote:
alert (eval ("document.forms['List'].LiveLinkLocation" + wid +
".value") );
http://jibbering.com/faq/#FAQ4_40

function confimDelete(wid)
{
alert(document.forms['List'].elements['ListLocation' + wid].value);
}

Thanks that's the syntax I was looking for.
Jun 8 '07 #5

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

Similar topics

0
by: Ian Pilcher | last post by:
Howdy all! I'm working with XML schemas for the first time, so please be gentle! I am working on a graphics program (in Java if it matters), and I have decided to use XML files to store the...
8
by: nrhayyal | last post by:
hi all, is it a good idea to assign object to pointers without initialising it to NULL? suppose if i have a class TEST class ELEMENT { private: int a; string s1;
3
by: Michael | last post by:
Hi all : in vb.net I know use the follow code can implement dynamic call Dim asm As = .LoadFrom(<FileName>) Dim ty As Type = asm.GetType(<Object Name and class name>) Dim obj As Object =...
70
by: jojoba | last post by:
Hello! Does anyone know how to find the name of a python data type. Conside a dictionary: Banana = {} Then, how do i ask python for a string representing the name of the above dictionary...
4
by: Bocephus | last post by:
I need to add the Names objects in my workbook to a Collection. However, it seems that there is never more than the first 256 objects in the MyWorkbook.Names list. I have maybe 2500 names that I...
6
by: William | last post by:
for example, I have a global object: extern Object myobj; Can gcc get this object by using string "myobj" at runtime?? I know C++ rtti doesnt support this, but I dont know if gcc can , ...
2
by: rpjd | last post by:
I have executed a php script via an xmlhttprequest and can see the results in an alert. But when I try to access the elements using getElementById or Name I get "object doesn't support this property...
2
by: Calm_Pear | last post by:
Hi all, I have created an object with a default function; the default function exposes a public function as well. myobject = function(){
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
5
by: RyanN | last post by:
Hello, I'm trying to teach myself OOP to do a data project involving hierarchical data structures. I've come up with an analogy for testing involving objects for continents, countries, and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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,...
0
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...
0
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...
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,...

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.