Results 1 to 9 of 9

Thread: DHTML Window can someone help

  1. #1
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Window can someone help

    1) Script Title:

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...ndow/index.htm

    3) Describe problem:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    function openWin()
    {
    myWindow=window.open('','','width=200,height=100');
    myWindow.document.write("<p>This is 'myWindow'</p>");
    myWindow.focus();
    myWindow.opener.document.write("<p>This is the source window!</p>");
    }
    </script>
    </head>
    <body>
    
    <input type="button" value="Open 'myWindow'" onclick="openWin()" />
    
    </body>
    </html>
    HOW to do the same with DHTML window??
    thank you
    Last edited by jscheuer1; 11-20-2010 at 07:37 PM. Reason: fix broken link, format code

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well you can't. There are no distinct windows. At most, if you use the iframe method, you have a parent and child window, both in the same main window, not an opener and opened window in separate windows as you can with the window.open() method. That's normally an advantage of DHTML window. It cannot be blocked by pop up blockers because it doesn't pop a new window.

    When the code in your post executes it wipes out the source window's content. You could get a similar effect with DHTML window. It would be more complicated though. You would have to leave behind whatever code is required to sustain the DHTML window. This would vary depending upon the type of DHTML window that it is, and upon the functionality you would require of its content.

    What exactly did you have in mind?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i want in new window to select an node of treeview (or any element of list) and send selected value to text input in parent window

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If you want a new window, you will have to work from the code in your original post. But if you want to use DHTML Window, you can access the launching page from the DHTML Window - in most cases with parent.whatever, example:

    Code:
    parent.document.getElementById('someid').innerHTML = 'it works!';
    To apply this to your particular DHTML Window, at least as I understand it - what your asking, in the DHTML Window you could have something like:

    Code:
    <select name="somename" onchange="parent.document.getElementById('mytext').value = this.value;">
    <option value="thefirst">One</option>
    <option value=thesecond"">Two</option>
    <option value="thethird">Three</option>
    </select>
    And on the page that launched the DHTML window:

    Code:
    <input type="text" id="mytext" value="thefirst">
    If you want more help, please post a link to a page on your site that shows your best attempt at doing this.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i can not send link to the page cos it is in cyrillic but
    HTML opens DHTML1 which open DHTML2 which open DHTML3
    DHTML3 must return value to DHTML2 and DHTML1
    is it possible???

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Probably. But for something like that I need to at least know what kind of DHTML Windows these are. Are they:

    1. Inline Text
    2. HTML from an invisible DIV on the page
    3. An external page shown inside an IFRAME
    4. An external page on the same site fetched via Ajax.


    Are they all the same kind or not?

    One thing I can tell you is that, if using iframe and the pages aren't on the same domain, or even just don't appear to be on the same domain to the browser, then communication between the pages will not work.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    in HTML
    kontirane=dhtmlwindow.open("kontirane", "iframe", "http://localhost/kontirane.php", "KONTIRANE", "width=800px,height=600px,left=200px,top=100px,resize=1,scrolling=1")

    in KONTIRANE
    <input type="text" size="6" name="smetka" id="smetka" ondblclick="openmypage()"/>
    top.sm=top.dhtmlwindow.open("sm", "iframe", "http://localhost/smetkoplan.php", "SMETKA", "width=500px,height=500px,left=0px,top=0px,resize=1,scrolling=1")

    and from top.sm must return value to kontirane.smetka
    is it posible or i need to use other type of DHTML
    thank you

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I see no:

    kontirane.smetka
    What's that?

    I can tell you that each iframe is named _iframe-id, where id is the id for the DHTML window made using the iframe method. The two you show would be:

    Code:
    _iframe-kontirane
    and:

    Code:
    _iframe-sm
    So from the page in _iframe-sm, do something like:

    Code:
    top.window.frames['_iframe-kontirane'].document.smetka.something = what
    That will need some tweaking. The something = what needs to be filled in. The code itself needs some kind of activation, perhaps from an event on the page in _iframe-sm. Accessing the document or the smetka in that iframe might be a little trickier. It would be much easier if the DHTML windows were made using any of the other methods - other than the iframe method. And I'd like to see the markup for what you're calling "kontirane.smetka".
    Last edited by jscheuer1; 11-24-2010 at 02:57 PM. Reason: add detail
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Oct 2010
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you
    this work perfect

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
  •