/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Cannot assign to a function result

Hi,

I have a drop down box which a number is selected, i just want that number updated in a textbox

[COLOR=”blue”]<select class=”style9″ name=”cbo<%=wkno&sday%>txt<%=empno%>” id=”cbo<%=wkno&sday%>txt<%=empno%>” onchange = “populateOT(this.value,<%=empno%>);”>
<option> etc etc etc…
</option>[/COLOR]

This is the drop down box, so when it is changed it should fire off the populateOT function

[COLOR=”Blue”]<td width = “50px” class=”style7″><input align=”center” class=”style9″ name=”txtOT1<%=empno%>” type=”text” size=”6″ id=”txtOT1<%=empno%>” value=”<%=OT1%>” onBlur=”isnum(this.name);”></td>[/COLOR]
Text box to be updated.

function populateOT(field,emp)
{

eval(“document.MOAREnterDets.txtOT1″ + emp +”.value”) = field;

}

but this fails with cannot assign result to a function. what am i doing wrong?

Thanks

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangJul 23.2008 — document.MOAREnterDets.elements['txtOT1' + emp].value = field;
Copy linkTweet thisAlerts:
@jwvoodooauthorJul 23.2008 — Excellent!! Thank you very much.
×

Success!

Help @jwvoodoo 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 6.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...