Results 1 to 4 of 4

Thread: CLOSE ISSUE WHEN CONTENT NAME PASSED TO open() AS VARIABLE

  1. #1
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CLOSE ISSUE WHEN CONTENT NAME PASSED TO open() AS VARIABLE

    1) Script Title: DHTML MODAL

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

    3) Describe problem:

    I wrote the modal open function to accept content as a variable - so that I can have different content in the same iframe. The problem is the parent.thismodalwindow.close() does not work when I pass the content name as variable. This is what I meant ...

    Code:
    <script type="text/javascript">
    function openurlmodal(targetUrl, boxTitle){ //Define arbitrary function to run desired DHTML Window widget codes
    var ajwin=dhtmlmodal.open("ajaxurlbox", "iframe", targetUrl, boxTitle, "width=650px,height=450px,center=1,resize=1,scrolling=1", "recal")
    ajwin.onclose=function(){return true}
    }
    
    <a href='#' onClick='openurlmodal("modalfiles/externalFormClose.htm", "Html!!"); return false'>Test Value Passing 2 !!</a>
    <br>
    And this is the code in the referenced content

    Code:
    <input type="button" value="CLOSE" name="X2" onClick="parent.ajwin.hide()"  />
    But this does not work.

    However in my open statement if I directly pass the content name in the open statement - the close button works

    Code:
    function openurlmodal(targetUrl, boxTitle){ //Define arbitrary function to run desired DHTML Window widget codes
    var ajwin=dhtmlmodal.open("ajaxurlbox", "iframe", "modalfiles/externalForm.htm", boxTitle, "width=650px,height=450px,center=1,resize=1,scrolling=1", "recal")
    ajwin.onclose=function(){return true}
    }

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    But, these are two different files:
    modalfiles/externalForm.htm - closes
    modalfiles/externalFormClose.htm - failed

    Was that an issue in the first place?
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It does not matter - which ever html is called by paasing the name a parameter - the close() fuction does not work from there.

    It is only when the name is passed a absolute value - the close function works.



    So when I open the window as

    Code:
    ajaxwin=dhtmlmodal.open("ajaxtextbox", "iframe", "modalfiles/externalFormClose.htm", ...
    The close works ..

    But if I do

    Code:
    ajwin=dhtmlmodal.open("ajaxurlbox", "iframe", targetUrl, ..
    and pass the targetUrl like

    Code:
    <a href='#' onClick='openurlmodal("modalfiles/externalFormClose.htm", "Html!!")>opoen </a> ..
    the close() does not work ..


    I AM NOT TALKING ABOUT THE 'X' button - it is the close button that is coded inside the reference html (externalFormClose.htm) ...

  4. #4
    Join Date
    Jun 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Found the solution .. actually it is documented in the script home page ..

    I was using 'var' before the window variable definition ..
    e.g.
    Code:
    <script type="text/javascript">
    function openurlmodal(targetUrl, boxTitle){ //Define arbitrary function to run desired DHTML Window widget codes
    var ajwin=dhtmlmodal.open("ajaxurlbox", "iframe", targetUrl, boxTitle, "width=650px,height=450px,center=1,resize=1,scrolling=1", "recal")
    ajwin.onclose=function(){return true}
    }
    solution is to drop the 'var'

    Code:
    <script type="text/javascript">
    function openurlmodal(targetUrl, boxTitle){ //Define arbitrary function to run desired DHTML Window widget codes
    ajwin=dhtmlmodal.open("ajaxurlbox", "iframe", targetUrl, boxTitle, "width=650px,height=450px,center=1,resize=1,scrolling=1", "recal")
    ajwin.onclose=function(){return true}
    }

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
  •