Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…
Suggested Courses

571 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