SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing values in the parent window

    I have the following code in a popup window.
    Code:
    <td bgcolor="#000000" onClick="javascript:setRGB(0, 0, 0);" class="swatch"></td>
    <td bgcolor="#000033" onClick="javascript:setRGB(0, 0, 51);" class="swatch"></td>
    <td bgcolor="#000066" onClick="javascript:setRGB(0, 0, 102);" class="swatch"></td>
    What I want to do is to define the setRGB function so that when I click on a color swatch (onClick) it updates 3 fields in a form in the window that opened the popup with the corresponding RGB values. So let's say that in the window that opened the popup i have a form 'formname' with three text fields named 'red', 'green' and 'blue'.
    Science is magic that works!
    -- Kurt Vonnegut Jr.

  2. #2
    Under Construction Poop_Shoot's Avatar
    Join Date
    Jul 2003
    Location
    Sacramento, CA
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure but you could try this
    parent.document.formName.red.value=" ";

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    If you are talking about windows and popups as in:

    var myWin = window.open(.....)

    You refer to the opening window as: opener
    So,

    opener.document.formname.fieldname.value = somevalue;

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •