/    Sign up×
Community /Pin to ProfileBookmark

problems accessing properties with dot as part of name

I have a property with name mybean.myproperty.

I have to access it from a javascript function, but this
does not work: myform.mybean.myproperty

does anyone know of a workaround? ?
Thanks in advance.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@Willy_DuittDec 17.2004 — document.forms['myform']['mybean.myproperty']
Copy linkTweet thisAlerts:
@MashaauthorDec 17.2004 — Thanks!?
Copy linkTweet thisAlerts:
@senshiDec 18.2004 — you can access arrays by that method, if you had an array...

x["red"]["pink"]="17";

then

y=x.red.pink;

would equal 17 as a string numeric
[CODE]
<script>
// set up an array and make elements
x=[];
x["red"]=[];
x["red"]["pink"]="17";

// access the value of the location x.red.pink and store into y
y=x.red.pink;
document.write(y); // display the value of y
</script>
[/CODE]

you can also assign to variables the document and windo propertys to test them, like...
[CODE]
<form><input type="text" value=""></form>
<script>
z=document.forms;
z_lth=z.length;
document.write("No. of Forms in this document are "+z_lth);
</script>
[/CODE]

Its all a question of how you reference your site data and the sites functions.
×

Success!

Help @Masha spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...