PDA

View Full Version : Glossy Accordion Menu & Javascript Problem



1019
01-08-2009, 06:14 PM
1) Script Title: Glossy Accordion Menu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm

3) Describe problem:
If I include asp or html file into the iframe, can javascript in this included asp/html execute? Without opening a new page, and only execute the data in the iframe, white the glossy menu still exist on the left hand side?
How do I make it executable?

Should I put the javascript inside the included asp which is pulled into the iframe? or Should I put the javascript in the same file where the glossy menu placed?


http://img353.imageshack.us/img353/590/picture2cn5.jpg

jscheuer1
01-08-2009, 06:35 PM
What do you mean by include? The purpose of an iframe is to remove any need for includes. Pages may be directly loaded into it. Once there, they will in almost all respects act just like the page loaded directly into the browser.

Even if the page loaded into the iframe has includes on it, if it all worked as a separate page, it should all still work in the iframe.

1019
01-08-2009, 07:09 PM
Hi John,

Sorry, let me revised the question.

There is javascript in (4).asp, and it works fine when seeing (4).asp link directly.

While in (1).asp, and clicking (2) menu, the (4).asp will be pulled into (3) iframe. However, javascript in (4).asp doesn't work at this situation while it's pulled in to (3) iframe in (1).asp file.

Is there a specific way to make the javascript works under this situation? I meant the javascript in (4).asp does work while it's independent link.

http://img99.imageshack.us/img99/1489/picture2ng2.jpg

jscheuer1
01-08-2009, 07:27 PM
How are you 'pulling in' to (1)? If you are using AJAX, it's usually quite complicated. Scripts and stylesheets on the imported page will usually not work and will need to be imported as well as (in the case of scripts) often initialized, or modified to require no new initialization with new content.

If it's an asp include, just launch the page (1) with the include on it in a separate tab or window. View its served source (browser's view menu > view source), make sure all of the paths on it and in it's resource files are correct for its location on the server.

Even with AJAX importation, the paths must still be valid for the page the new imported content is on.

So there are really two issues. Once you bring new content to a page, that imported content's paths must be valid on the page it is being imported to.

If this is an AJAX import, other issue dealing with scripts and styles will quite possibly exist.

The iframe is a red herring, what works in a separate window should work in it.

1019
01-08-2009, 07:39 PM
Hi John,

I'm not sure what you meant by "How are you 'pulling in' to (1)".
I got this sources from here (http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu-glossy.htm)
On the bottom, there is "Glossy Accordion Menu with responsive headers", I like the way when clicking BLUE Menu- "CSS Examples" or "CSS Drive", an external link is loaded into the iframe on the right.

I would like to do the same, make (4).asp loaded into the iframe, but also make javascript in (4).asp works fine under this situation. NOTE: (4).asp works fine independently

jscheuer1
01-08-2009, 10:34 PM
Sorry, your poor spelling threw me off:

"pulled in to (3) iframe ni (1).asp file."

But I think I have it now. If 3 really is an iframe, there should be no problem. In fact, the example you represent in your image from Dynamic Drive does just that. When external pages are loaded into the iframe, their scripts work just fine.

There could be so many reasons why you are having a problem with this, but I'm almost 100% sure that none of them have to do with iframe.

To diagnose your problem(s), we would need a link to a page on your site that demonstrates the problematic pages in action.

Be sure to mention what we need to do to replicate the problem.

1019
01-09-2009, 11:01 PM
sorry for the typo.

At this point, I think the problem I have is more about combining it with Ajax. Like execute JavaScript function after AJAX loaded problem...


Another question, the example shows on dynamicdrive enables users to load external file into the iframe, but only through the Header. Is there a way to make it work as well under the sub-menu <ul><li>?

jscheuer1
01-10-2009, 03:49 AM
Please post a link to the page on your site that contains the problematic code so we can check it out.