Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Returning argument to textarea in opener

Posted on 2002-07-25
Medium Priority
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 300 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: 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.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

618 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