Results 1 to 5 of 5

Thread: Generic Drag Script doesn't work in child window

  1. #1
    Join Date
    Oct 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Generic Drag Script doesn't work in child window

    I'm using the Generic drag script for a <div> layer in a child window. The drag script is in the parent window and I can't seem to access this script from the child window's layer. I can attach the script to anything in the parent window and it works fine... just not from the child window. I've tried referencing the parent script any number of ways unsuccessfully. Can anyone point me in the right direction?

    Thanks

  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

    Do you mean parent/child as in two separate windows or as in a window with a frame or iframe on it?

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.
    PLEASE: Include the URL to your problematic webpage that you want help with.

    Added later. I looked into this a bit more since I first posted. If you mean a separate window, you would be better off putting the script on the page where you want to use it. Even in a frame or iframe this would be the case. The script uses so many references to the page that it is on that, even though you can access it from another page, it (the script) will have difficulty accessing that second page where your 'dragable' content is.
    Last edited by jscheuer1; 10-24-2005 at 08:48 PM.
    - John
    ________________________

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

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

    Default more on child window and generic move

    I've tried to incorporate the generic move text into my child window but have encountered the following problem. The child window, and the <div> layer which I'm trying to attach the move script to, is dynamically created by javascript within the parent window. Whenever I try to insert <script></script> tags into the generated content (with or without the .js move code), the window throws an error and won't render. It's almost as if the <script> tags are reserved and can't be embedded in the dynamic text. Any ideas?
    Thanks,
    Don

  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

    It just stands to reason that if you have something like this:

    Code:
    <script type="text/javascript">
    document.write('<script src="generic_drag.js" type="text/javascript"></script>')
    </script>
    The script parser will think that the script is over when it hits the first </script>, making the document.write statement invalid, due to an unterminated string variable or literal (depending on the parser). If instead you break it up, like:

    Code:
    <script type="text/javascript">
    document.write('<script src="generic_drag.js" type="text/javascript"><' + '/' + 'script>')
    </script>
    Then the script will only see the last </script> as the end of the script.
    - John
    ________________________

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

  5. #5
    Join Date
    Oct 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default slice 'n' dice

    Thanks for the suggestion.... breaking the tag script up worked perfectly! The layer in the child window slides around like it's on glass now.

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
  •