Javascript won't run after being loaded into


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Javascript won't run after being loaded into

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Posts
    0

    Javascript won't run after being loaded into

    I am working to create a more dynamic way to view speaker information for a conference. I initially developed this, a page that basically has two iframes in which i basically pull queries from our database. One iframe contains a list of links; you click on the links, and it will pass on a query string to the second iframe and put all the info into an accordion menu. I really don't like using iframes, and especially hate how it cuts off the content and sticks in a scrollbar if it's just slightly too long. I wanted something more fluid looking and set out to dynamically insert the asp results directly into a div.

    At first I tried using an XMLHttpRequest, and while i managed to get the content to successfully load into the div, it for some reason disabled the javascript command that initiated the accordion menu.

    I tried moving the initiate command from the bottom of the asp page where i actually create the accordion menu to the referencing url (from the first iframe). I also tried using the timeout feature in the referencing url, and that didn't work. I tried having it initialize from the XMLHttpRequest function, and that didn't work either. I tried loading it into an html panel instead, and while it still loaded, the javascript was still disabled. Also, the javascript will work if you run it manually from the url bar in the browser after the page has loaded. Oddly enough, when i added an alert to the accordion menu javascript file, then the accordion menu started working. You can see almost all my files with firebug.

    I am not a developer or coder. The code for the accordion menu and the html panel came from Adobe templates and the idea for the XMLHttpRequest came from w3schools. I'm a graphic designer who's just trying to pick this stuff as I go along, so please be specific and as non-hypothetical as possible.

    Please help!! I've pretty much spent two solid days trying to figure this out. I have no idea what's going on and have run out of developer friends to pester.

  2. #2
    Join Date
    Mar 2007
    Location
    Bangalore, India
    Posts
    247
    You get the contents for the accordion menu via Ajax right?

    If so, try this: add the manual command to run it in the Ajax code's onstate change method.

    ie after this:
    Code:
     if (xmlhttp.status==200)
    {// 200 = "OK"
    document.getElementById('col_2').innerHTML=xmlhttp.responseText;
    It probably doesn't work because the content is not yet available when the accordion javascript is running.

Similar Threads

  1. Replies: 0
    Last Post: 03-10-2007, 11:24 PM
  2. Serious JavaScript
    By Complete in forum Web
    Replies: 1
    Last Post: 09-25-2006, 10:56 AM
  3. Replies: 1
    Last Post: 09-13-2001, 10:43 AM
  4. Replies: 0
    Last Post: 09-12-2001, 11:14 AM
  5. Replies: 2
    Last Post: 03-24-2001, 10:39 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center