Results 1 to 6 of 6

Thread: dhtml window widget (iframe type bug)

  1. #1
    Join Date
    Mar 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default dhtml window widget (iframe type bug)

    1) Script Title: DHTML Window Widget (v1.1)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

    3) Describe problem:

    hi all, i got a problem on this dhtml window widget when i'm using iframe type of dhtml windows..
    here is the problem : i need the page to setfocus on the dhtmlwindow (iframe type) whereever i click on the dhtml window, not only on the drag handler. this problem occurs only when i'm using the iframe type.

    example using the url above : when the page load there're 2 dhtml window, #1 is the google website (using iframe type), the #2 one is broadcast title (inline type). when i click on the #2 it will setfocus and bring that window to the top, then i need to get back to the google website (#1) and i just click on the body of the dhtmlwindow(not on the draghandler) and it won't setfocus though i can type on the textfield etc..

    i need the iframe type dhtmlwindow to setfocus whereever i clicked the dhtml window, whether it's on the body of the iframe, or the draghandler..

    anyone can help?
    ddrive is cool..but i think it'll be much better that way...
    thx...

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Unless the page contained in the IFRAME is from your own domain, it's not possible to set focus on the DHTML window when the IFRAME area is clicked on. This is due to cross browser JavaScript limitations. Lets say you're showing Google.com inside the DHTML window- there's no way for the script to react to when the user clicks within the Google page, as that action occurred outside your own domain.

  3. #3
    Join Date
    Mar 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok, the pages i opened in the dhtml window is my own pages, which i can modify as my wish..
    but, how do i make the page to access the parent's objects(to setfocus itself)?
    i can't find the event handler onClick on the <body> tag.should i put the onClick event handler on any object of the page?
    thx...

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Well, if the page contained in your IFRAME is within your domain, setting focus on the DHTML window when the user clicks inside the IFRAME is possible, yep. Lets say the window is opened via the code:

    Code:
    var mywin=dhtmlwindow.open("pagebox", "iframe", "test.htm", "My pets", "width=590px,height=350px,resize=1,scrolling=1,center=1")
    Inside test.htm, you'd add the following to the BODY tag to enable focus onclick:

    Code:
    <body onclick="parent.dhtmlwindow.setfocus(parent.mywin)">
    Notice the part in bold, which should match up with the variable instance name you assigned at the beginning.

  5. #5
    Join Date
    Mar 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok thx so much buddy...
    it works...
    God bless you

  6. #6
    Join Date
    Aug 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, i just found this solution while searching for the exact same issue, however it's not working for me!?
    I'm using the below script to open multiple windows, each with a unique indentifier, the page in the iframe has this bodytag: <body onClick="parent.dhtmlwindow.setfocus(parent.iframewindow)"> however there's no focus on click inside the window.

    <script type="text/javascript">
    <!--
    function openmenu_iframe(url,title,id){
    // this opens a centered window, each unique id will have it's own window
    iframewindow=dhtmlwindow.open(id, "iframe", url, title, "width=1000px,height=600px,center=1,resize=1,scrolling=1")
    //-->
    </script>

    Any ideas?

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
  •