Results 1 to 3 of 3

Thread: Javascript within DHTML window

  1. #1
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Javascript within DHTML window

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

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

    3) Describe problem:
    I am trying to run some javascript calls on an html form within an ajax content window (window 3). It does not seem to be working properly. Is there a special way to reference object ids or function calls within the window that I'm missing?

    for example, the following does not work inside the modal window:

    <script type="text/javascript">
    function myFunction(id) {
    document.getElementById( id ).style.background="DBDBDB"}
    </script>

    ...

    <input type="text" name="foo" id="foo" onClick="myFunction('foo');">

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

    Default

    Ah this isn't an issue with the script, but rather, just a pesky limitation of Ajax. Pages fetched via Ajax should they contain JavaScripts within it in many cases won't run correctly when brought over this way. Ajax basically copies the contents of the external file similar to copying plain text and just dumps it onto the main page. Browsers don't know to interpret scripts or even CSS (in IE) within that copied content.

    The easy solution in this case is just to switch to the IFRAME version when showing pages within JavaScript in it inside the DHTML window.
    DD Admin

  3. #3
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That did it, thanks!

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
  •