Results 1 to 4 of 4

Thread: Problem With Switch Content Script

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

    Question Problem With Switch Content Script

    first of all, thanks to whoever supplied this free script. it has saved me a lot of time and effort!

    i am having a small problem with it and wonder if somebody might help me.

    i am designing an ASP.NET page and I have put a dropdownlist inside one of the dynamic layers. when my DropDownList posts back i am trying to set the focus back to it by doing this:

    document.getElementById('myDropDownList').focus();

    i notice that if I remove the 'Switch Content Script' then my DropDownList focuses ok after a post back. otherwise I get the error message saying it can't set focus on my control because its not there.

    i presume this is something to do with the chain of events i.e. my focus script is trying to set focus to a control which has not yet been revealed by the Show/Hide script. however i have tried placing my focus script right at the end of the page and it still wont work.

    can anyone help me?

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

    Default

    can anyone help me with this issue pls?

  3. #3
    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 memory serves, switch content works by rendering display='none' for those sections waiting in the wings, as it were. You cannot give focus to such an element or one contained in such an element. I ran into something similar with a text input field inside one of these switch content divisions. The solution there was to go to the section in the script where content is inserted/removed from the flow of the document and adding in some language to test if the input's containing division's display property was set to 'block', set focus on the input element. If you need help doing this or adapting it to your situation:

    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.
    - John
    ________________________

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

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

    Default

    hello john thanks for your reply.

    i apologise that my thread was not in the correct format it is my first post and i must confess that i did not read the sticky.

    i will go away and spend some time trying to fix this for myself going off what you've just told me. if not i will create a new post in the correct format and attach a URL example.

    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
  •