Hey I wanted to make something where when a person clicks a link a popup comes in the center of the page with a whole list of usernames. When the person clicks a username the popup closes and the username appears in a textbox. How can I do this?
04-14-2005, 10:27 PM
the pop up is a child window of the original window...
you need a script in the child source code that does this:
make sure you lable the link's id with what you want to pass back to main window.
04-14-2005, 10:40 PM
I really dont know anything about js, can you explain to me how to use it? I got it to where if you click a link it opens a popup with that code in it, but then what?
04-14-2005, 10:50 PM
in the <a> tag you need to make sure that the part I told you "this.value" says this.id (no quotes).
<!-- this goes into child source code-->
<a href=#stayhere id='username1' onclick='LinkV(this.id);'>username1</a>
opener.document.getElementById('your text area id').value=val;
<!--stop child source code>
in the above where it says: opener.document.getElementById('your text area id').value=val;
be sure the part that says 'your text area id' is the id value of the textarea or input you are using in the original document.
<!--original window source-->
<!--end original window source-->
how this works is if a window is opened by another window it is concidered to be a child window and the browser knows what window opened it. if you use opener.document.getElementById('textarea1').value='whatever' the browser know that the opener is the original window and then it goes from there with looking into the document and finding the element with the id textarea1 and then fills in the value.