The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
Send javascript text from pop-up to form field in parent window
Discuss Send javascript text from pop-up to form field in parent window in the JavaScript Development forum on Dev Shed. Send javascript text from pop-up to form field in parent window JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 6th, 2001, 02:47 PM
|
|
El Guapo
|
|
Join Date: Jul 2001
Location: You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue.
Posts: 56
Time spent in forums: 1 h 7 m 47 sec
Reputation Power: 12
|
|
Send javascript text from pop-up to form field in parent window
Greetings,
I'm trying to send some text from a pop-up to a form-input text field in another window.
I have this in the header of the main window:
Code:
<script language="JavaScript">
<!--
self.name = "index";
-->
</script>
And I want to enter text into the form field named "message" from the pop-up window (based on clicking on an href link in the pop-up).
Can this be done?
I'm trying to make a "smilies" pop-up for a message board that will display the smilies (which I've done) but then make the smilies clickable (as they are on this message board, for instance) so that the smiley character text is inputted to the message window.
-- Jough
|

August 6th, 2001, 04:55 PM
|
|
Contributing User
|
|
Join Date: Jan 2001
Location: Atlanta
Posts: 39
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
I haven't tested this out, but I believe it will work. You should be able to access the form in the parent window this way:
window.opener.document.form.field.value = "some value"
Good luck.
Lucas Alexander
http://www.alexanderdevelopment.net
|

August 6th, 2001, 05:20 PM
|
|
El Guapo
|
|
Join Date: Jul 2001
Location: You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue.
Posts: 56
Time spent in forums: 1 h 7 m 47 sec
Reputation Power: 12
|
|
I'm sorry, I'm rather new to javascript.
So what would I include in my link?
Code:
<a href="window.opener.document.form.field.value
= javascript: smilie(':)')"><img src="(image link)"></a>
??
I guess I just don't know which of those parts need to be changed (with values) and which need to stay as they are.
-- Jough
And I can't seem to add the code without the script parsing it. Grrrr....
Last edited by jough : August 6th, 2001 at 05:23 PM.
|

August 9th, 2001, 12:16 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Posts: 81
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
Your link should look something like:
<a href="javascript :void(window.opener.document.form.field.value
= smilie('  ')")><img src="(image link)"></a>
The "void" is there because otherwise the browser in your popup will try to navigate to the results of the assignment.
|

August 9th, 2001, 01:33 AM
|
|
El Guapo
|
|
Join Date: Jul 2001
Location: You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue.
Posts: 56
Time spent in forums: 1 h 7 m 47 sec
Reputation Power: 12
|
|
|
Okay, but I still can't get this to work.
Do I just use the link as is, or do I have to substitute the name of the form, field, etc. And what would I put for "value" then?
I've pretty much tried and erred as much as I can - trying many different permutations.
I can make it work in IE but not Netscape or Opera.
It's just all so frustrating.
-- Jough
|

August 9th, 2001, 01:47 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Posts: 81
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
You'll need to subsititute the following:
form -> the name of your form (e.g., <form name="myform">, would be "myform")
field -> the name of your input field (e.g., <input type="text" name="mytextfield"> would be "mytextfield">
value stays as is.
|

August 9th, 2001, 10:29 AM
|
|
El Guapo
|
|
Join Date: Jul 2001
Location: You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue.
Posts: 56
Time spent in forums: 1 h 7 m 47 sec
Reputation Power: 12
|
|
|
I figured as much (and had tried that before, but without the "void").
But alas, this doesn't work in any browser. Maybe it's because of all of the includes - the pop-up may not know who its parent is.
Sigh.
-- Jough
|

August 9th, 2001, 07:17 PM
|
|
Contributing User
|
|
Join Date: Feb 2001
Location: USA
Posts: 830
Time spent in forums: 3 h 17 m 56 sec
Reputation Power: 13
|
|
|
Well, as we've all learned, painfully, Netscape Navigator is the single most worthless thing ever unleashed upon the face of the Earth by man (and I don't want to hear any snide remarks about the flowbee or DIVX-- ask yourself, when did those ever cause you this much pain?). I'm all for forming an angry, violent mob to track down the people responsible for this abomination to give them what they so truly deserve. Naturally, the window.opener property, among other features of the JavaScript language, brought to us by Netscape, does not work in the Netscape browser, even though their documentation says it does. If it does, then I'll be damned. Belie dat.
I motion that we, meaning anyone who reads this thread, hereby form a movement in the web development, and preferably, additionally the web browsing community, to boycott use of any Netscape browsing product from this point forward, to be repealed only if they release a browser which complies with basic standards of common decency. Recruit everyone you know. Give them a copy of Internet Explorer. Help them install it. Help them configure it. Help them banish Netscape Navigator from their system. Netscape is floundering: let us join forces and drive the final nail into it's beckoning coffin.
|

August 10th, 2001, 01:14 AM
|
|
El Guapo
|
|
Join Date: Jul 2001
Location: You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue.
Posts: 56
Time spent in forums: 1 h 7 m 47 sec
Reputation Power: 12
|
|
|
I actually *like* Netscape usually, even though I've been using Opera mostly, now.
Oh, and window.opener doesn't work in Opera, either.
Is this an IE only thing, or actually part of the javascript language? Doesn't Sun own javascript?
-- Jough
|

August 10th, 2001, 07:49 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Location: USA
Posts: 830
Time spent in forums: 3 h 17 m 56 sec
Reputation Power: 13
|
|
Sun has nothing to do with JavaScript. It was developed by Netscape and originally called LiveScript -- they changed the name to JavaScript to try to cash in on the popularity of Java (developed by Sun).
It doesn't suprise me that it doesn't work in Opera, nor does it matter -- Opera is a joke, a total non-factor. Why should anyone PAY for a sub-standard browser???
It is NOT an IE only thing, it is part of the JavaScript standard. In fact, you can read all about how well it works in Navigator in their documentation at http://developer.netscape.com/docs/...e4/contents.htm and http://developer.netscape.com/docs/...jsref/index.htm
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|