Returning argument to textarea in opener

Posted on 2002-07-25
Last Modified: 2011-04-14

I am creating a website for an artist friend of mine. The main page has (a)a textarea, and (b)thumbnails of his work. When you click on a thumbnail, a popup opens via:

<a href="javascript:bigPicture('florentine.jpg','Florence Skyline','Oil on Canvas','5x7','1');">

Function bigPicture takes these arguments:
function bigPicture(filename,picname,medium,dimensions,status){

... successfully print all the html, with the arguments as description ....

Now the tricky part, based on the "status" argument.
User sees:

"sold.gif" if status == 0
"inquire.gif" plus a checkbox if status > 0

If the user checks the checkbox, the "picname" is added to the textarea on the main page, building a list of inquiries for the user to email.

I don't care if this is a checkbox, or if "inquire.gif" is a button, or what. I just can't get the value of the argument "picname" to go back to the textarea. Sometimes this is more than one word, so it will contain spaces. I don't know if that's the problem or not.

I am currently using:

if (status == 0 ){win.document.write('<img src= "./img/sold.gif">');}

if (status > 0 ){
win.document.write('<form><img src="./img/inquire.gif"><input type="checkbox" onClick="self.opener.document.forms[0].inqfield.value=picname;"></form>');

If I replace "picname" (in last line, above) with a numberic value, it WILL write to the textarea, but it will not otherwise take any text, variables or otherwise.

I greatly appreciate any advice. As this is a favor to a friend, it is also completely alterable, if you think I'm going about this all wrong.

Thank You Thank You THank You for any and all help.
Question by:celere
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 7178904

you're going to have to build an array to hold the values you want to show in the text box.  if the user selects a picture they want, then it add that pictures information to the array, which inturn displays in the textarea.

 ~ MastaLlama ~

Expert Comment

ID: 7178906

you have 5 unlocked questions that are more than a month or so old.  Please take care of these questions or noone will want to help you.

 ~ MastaLlama ~

Author Comment

ID: 7178936
Hello MastaLlama:

Most of those questions were still unlocked because I didn't receive a solution to them. But I awarded the points to the "closest answer" anyway.

I did try using an array:

var abb = [filename, picname, medium];


win.document.write('<form><img src="/img/inquire.gif"><input type="checkbox" onClick="self.opener.document.forms[0].inqfield.value=abb[1];"></form>');

but this doesn't work either. Is there another way?


Accepted Solution

mastallama earned 100 total points
ID: 7178984
The following will add to the textarea when you click on the checkbox.  check it out and see if it does what you are looking for.  i'm working on when you uncheck to pull it out of the textarea.


function AddCart(param){
     var arrItems = document.all.text1.value
     if (document.all[param].checked == true) {
          document.all.text1.value = document.all.text1.value + "\n" + document.all[param].value
<input type=checkbox value="Item 37" name=check1 onClick="AddCart('check1')">Item 37<br>
<input type=checkbox value="Item 38" name=check2 onClick="AddCart('check2')">Item 38<br>
<input type=checkbox value="Item 39" name=check3 onClick="AddCart('check3')">Item 39<br>
<textarea name=text1 cols=100 rows=25 readonly>Your current order:</textarea>



 ~ MastaLlama ~

Author Comment

ID: 7179250
Thanks! I didn't use your exact code, but I definitely needed to include the checkbox value and name, which I was not doing before.

Here is what I have:

if (status > 0 ){
var querylist = inqtext + "\n";  //inqtext = textarea.value
querylist +=  picname;

win.document.write('<form><img src="/img/inquire.gif"><input type="checkbox" value="' +querylist+ '" name="checkpick" onClick="self.opener.document.forms[0].inqfield.value = this.value;"></form>');

I have other q's I'll post tomorrow. Thanks again.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hta File displays dynamic File names 4 65
Where is this content coming from? 4 39
object method as an event handler 8 74
hide and show spans from dropdown selection 3 36
Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question