/    Sign up×
Community /Pin to ProfileBookmark

Parsing values in variables fields

Hi there,

im stuck on very simple function.

function pasteValue(ref, value) {

window.opener.parent.frames[0].document.forms[2].[B]ref[/B].selectedIndex = value
}

Ofcourse, the [B]ref[/B] isn’t replaces with its given value to the function.

So next i tried:

function pasteValue(ref, value) {

var frm = window.opener.parent.frames[0].document
var fld = frm.getElementByName(ref)
fld.selectedIndex = value
}

method isnt supported.

How do i make a simple function that allows me to set the value of a variable field. This field exists on the window.opener.

TY in advance

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@AncoraNov 03.2005 — I don't know what the [2] is after 'forms', and "value" is a reserved word, but try this, instead, obviously, 'frameName' and 'formName' should be the actual names, and 'ref' must be the NAME of the select list:

[CODE]function pasteValue(ref, currIdx) {
window.opener.parent.frames['frameName'].document.forms['formName'][ref].selectedIndex = currIdx;
}[/CODE]
Copy linkTweet thisAlerts:
@jvanhalderenauthorNov 04.2005 — Working very nicely /bow
×

Success!

Help @jvanhalderen 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.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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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