JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 6th, 2001, 02:47 PM
jough jough is offline
El Guapo
Dev Shed Newbie (0 - 499 posts)
 
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 jough User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 7 m 47 sec
Reputation Power: 12
Question 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
__________________
See my PHP in action:
Poetry Archives

Reply With Quote
  #2  
Old August 6th, 2001, 04:55 PM
lucasalexander lucasalexander is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Atlanta
Posts: 39 lucasalexander User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via AIM to lucasalexander Send a message via MSN to lucasalexander
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

Reply With Quote
  #3  
Old August 6th, 2001, 05:20 PM
jough jough is offline
El Guapo
Dev Shed Newbie (0 - 499 posts)
 
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 jough User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #4  
Old August 9th, 2001, 12:16 AM
rdominy rdominy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 81 rdominy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via ICQ to rdominy
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.
__________________
Robert Dominy
About Guide for JavaScript
http://javascript.about.com
Software Consulting & Development
http://www.angusog.com

Reply With Quote
  #5  
Old August 9th, 2001, 01:33 AM
jough jough is offline
El Guapo
Dev Shed Newbie (0 - 499 posts)
 
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 jough User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #6  
Old August 9th, 2001, 01:47 AM
rdominy rdominy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 81 rdominy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Send a message via ICQ to rdominy
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.

Reply With Quote
  #7  
Old August 9th, 2001, 10:29 AM
jough jough is offline
El Guapo
Dev Shed Newbie (0 - 499 posts)
 
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 jough User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #8  
Old August 9th, 2001, 07:17 PM
JMM JMM is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2001
Location: USA
Posts: 830 JMM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #9  
Old August 10th, 2001, 01:14 AM
jough jough is offline
El Guapo
Dev Shed Newbie (0 - 499 posts)
 
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 jough User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #10  
Old August 10th, 2001, 07:49 AM
JMM JMM is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2001
Location: USA
Posts: 830 JMM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Send javascript text from pop-up to form field in parent window

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap