By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,480 Members | 1,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,480 IT Pros & Developers. It's quick & easy.

Help: Document object's property

P: n/a
How do I use a variable value within the document object's property?

That is, if I have:

document.profile_form.firstname.value=fname;

How do I make it more generic, like this:

desired=fieldname
document.profile_form.desired.value=fname;

Where firstname is the current field name.

Craig

w1******@hotSPAMmail.com (remove SPAM befor emailing)
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <9-********************@comcast.com>, w1zard10
@hotSPAMmail.com enlightened us with...
How do I use a variable value within the document object's property?

That is, if I have:

document.profile_form.firstname.value=fname;

How do I make it more generic, like this:

desired=fieldname

If you had the name of a field and wanted dynamic addressing...

desired = "firstname";
document.forms["formname"].elements[desired].value = somevalue;

--
--
~kaeli~
A midget fortune teller who escapes from prison is a small
medium at large.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2

P: n/a
"Craig L" <w1******@hotSPAMmail.com> writes:
How do I use a variable value within the document object's property?


<URL: http://jibbering.com/faq/#FAQ4_39 >
Good luck :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

P: n/a
Thanks. It worked out great.

Craig

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <9-********************@comcast.com>, w1zard10
@hotSPAMmail.com enlightened us with...
How do I use a variable value within the document object's property?

That is, if I have:

document.profile_form.firstname.value=fname;

How do I make it more generic, like this:

desired=fieldname

If you had the name of a field and wanted dynamic addressing...

desired = "firstname";
document.forms["formname"].elements[desired].value = somevalue;

--
--
~kaeli~
A midget fortune teller who escapes from prison is a small
medium at large.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.