Web Analytics Made Easy -
StatCounter Parent / Child Images - CodingForum

Announcement

Collapse
No announcement yet.

Parent / Child Images

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Parent / Child Images

    Parent window I need a text box

    child window some images.
    when you click an image, it closes the window and fills the parent text box with the name of the picture.
    how can I do this? I've found an example if the child page had a text box, but I need images.

    I have no real javascript knowledge.
    thanks,

  • #2
    Hmm I hope this works, i cannot trest now os correct me if there are errors.

    parent:
    <input type="text" id="mycooltextbox" />

    child (I suppose it's a window popped up from the parent)

    <img src="1.gif" onclick="javascript:doStuff(event);" />
    <img src="2.gif" onclick="javascript:doStuff(event);" />
    ....
    function doStuff(e)
    {
    var target = (e.target || e.srcElement);
    window.opener.document.getElementById('mycooltextbox').value = target.src;
    }

    Comment


    • #3
      Parent/Child Help

      Hi fella,

      heres the answer to your question. First of all, your'e thinking along the wrong lines of window relationship ands communication. If you want the image to operate the contents of another window, then this is not your child, but your parent window. It will operate better. when using multiple window manipulation, you have to look at which window is the user principally operating, then look at what the otehr windows are doing, much like a spider graph working out from the central point. Also, I would like yo uto take into consideration of the fact that every time you open up a new window, yo uare taking up server recourses, therefore you will ned to be careful on this one. Using a timer so the window times itself out before the 20 minute session end contingency comes into effect, so you dont risk losing your memory resourses to a user inactivity.

      Now then.

      I would say that if you have an image (or images in the parent window if you like...) and when the image is clicked on, a window or textbox pops up with the image name (personally i'd be using a textfile will speed the process up, and look just the same, and be alot quicker on those with slower connections viewing the process.), for this system I generally would use a client process so when the user clicks on an image, the system checks whether a window from another image is open, if it finds one then closes it, then afterwords, opens the window relevant to the current image the use has clicked on. Application planning my man, if you have any knowledge of programming this si the key to anything when you first learn a new language. Take note.. Any how this si generally the code I would use. Attached as a text file, so open and view.

      P.S. hoe you dont find this post condecending, but genrally like to explain my solutions rather than just post the code, after all , forums are there for people to share knowldge and learn from. Not just pajurise.

      ta for now.

      Kai
      Attached Files

      Comment


      • #4
        Ravenn,

        That is the closest I've been in two day! Thanks!
        Now If I can close the window upon clicking the image and not have the full path of the image and just the image name... I'd be set.

        thanks


        update:
        got the window to close.. need Just the pic name in the text box.
        looks like it's not passing the id, put the full url and pic name
        Last edited by clownbarf; Aug 1, 2005, 09:35 PM.

        Comment


        • #5
          Got it now..
          thanks for all the great help!!!!!!!!!!!!!!!!!

          Comment

          Working...
          X