/    Sign up×
Community /Pin to ProfileBookmark

Help! Text Copy

Ok, I am fairly new to .js and I need some help. Here is my situation.

Objective: To copy select text (text box) from child window to parent window (text box).

Setup: The parent window has several input fields and the child window has only one input field. I am opening/filtering the child window from the parent when I need to select an option for that input field.

Problem: I can make it work with one input field but I need to have different input fields and I want to use the same child window. The selction I make always go to input field1.

Below is the script I have so far.

<script langauge=”javascript”>
function post_value(){

if(document.form1.FieldID.value = 1){
opener.document.form1.Field1.value = document.form1.c_FieldID.value;
}
else if(document.form1.FieldID.value = 2){
opener.document.form1.Field2.value = document.form1.c_FieldID.value;
}
else {return false;
}

self.close();
}
</script>

Hope this makes sense to someone and you can guide me in the right direction.

Thanks,
Shawn

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangJun 21.2007 — Field values are text not integers
&lt;script type="text/javascript"&gt;
function post_value(){

if(document.form1.FieldID.value [COLOR="Green"]== "1"[/COLOR]){
opener.document.form1.Field1.value = document.form1.c_FieldID.value;
}
else if(document.form1.FieldID.value [COLOR="Green"]== "2")[/COLOR]{
opener.document.form1.Field2.value = document.form1.c_FieldID.value;
}
else {return false;
}

self.close();
}
&lt;/script&gt;
Copy linkTweet thisAlerts:
@tspatrickauthorJun 21.2007 — Fang,

Thanks for the reply. That did the trick.

Shawn
×

Success!

Help @tspatrick 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.12,
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,
)...