Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Returning argument to textarea in opener


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.
  • 3
  • 2
1 Solution

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 ~

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 ~
celereAuthor Commented:
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?

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 ~
celereAuthor Commented:
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now