PDA

View Full Version : Accordion Menu



miklos
10-26-2010, 11:51 PM
1) Script Title: Glossy Accordion Menu.

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

3) Describe problem: Getting the onopenclose function to display the href contents to a named frame. Can this be done using the onopenclose function? If not, is there an alternate method?

I would like to use the onopenclose function to display the href contents in a named frame like the target="frameName" anchor tag attribute does.

I have a frameset that contains a frame named ideas_home into which I would like the href content to be displayed. I have tried various permutations to the location.replace statement in the onopenclose function but none perform as hoped. I don't have an external website where you can see this live but the following code snips and behavior descriptions should help.

Behavior Description: The following syntax causes the href contents to display in the frame that the menu is displayed in. The href being passed uses the target="ideas_home" attribute. This indicates that the function is working to display the href content - just not to the correct frame - seems to be ignoring the target= attribute of the href value.


<snip>
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
if (state=="block" && isuseractivated==true){ //if header is expanded and as the result of the user initiated action
location.replace(header.getAttribute('href'))
}
}


Behavior Description: The following syntax causes all the headers to display opened revealing all submenuheader items - I think the incorrect syntax is honking the script. When clicked, the menu items do create the href content in the correct frame but I don't think this is the onopenclose function working, I think it is the anchor tag attribute working.

<snip>
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
if (state=="block" && isuseractivated==true){ //if header is expanded and as the result of the user initiated action
window.frames.["ideas_home"].location.replace(header.getAttribute('href'))
}
}

Cheers.

ddadmin
10-27-2010, 08:31 AM
The 2nd example on the Glossy Accordion page should illustrate how to load the URL of each accordion header inside a particular IFRAME. Using the code you posted above, it might look something like this:


onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
if (state=="block" && isuseractivated==true){ //if header is expanded and as the result of the user initiated action
window.frames["ideas_home"].location.replace(header.getAttribute('href'))
}
}

miklos
10-27-2010, 08:55 PM
I think that the only difference in your code and my second <snip> is that mine includes the dot in between the word frames and the [.

New code:
<snip>
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
if (state=="block" && isuseractivated==true){ //if header is expanded and as the result of the user initiated action
window.frames["ideas_home"].location.replace(header.getAttribute('href'))
}
}

I removed the dot, reloaded the page, clicked on the header and received the following error.

A Runtime Error has occurred.
Line: 30
Error: 'window.frames.ideas_home.location' is null or not an object.

I have tested the href using a link in one of the submenu items and that href does display the href content in the frame named ideas_home. Does the onopenclose function need to have the frame name object explicitly declared?

ddadmin
10-28-2010, 08:04 AM
Is "ideas_home" the name of your IFRAME as defined using the name attribute? For example:


<iframe name="ideas_home" style="width: 90%; height: 300px; border:1px solid black"></iframe>

p.s: Please format any code in your post using the CODE tag. This makes it a lot easier to read it.

miklos
10-30-2010, 12:53 AM
I am displaying the accordion menu content in a frameset that contains a couple of frames - one of which is called "ideas_home". The frameset also includes a frame called "ideas_menu" in which the accordion menu content is displayed. Since the accordion menu content is being displayed within a frameset, I can use the target= attribute to display any submenu item href content in any one of the frames defined to the frameset. The behavior I'm looking for is that when the header item is clicked, two things happen. 1) the submenu items are displayed and 2) an href associated with the header item and the onopenclose event displays content in the frame name called "ideas_home".

I don't have any experience with the iframe tag. No, I do not have any iframe defined. I'm using regular <frameset> & <frame> tags into which the accordion menu and other content are being displayed as I describe above.

Here is the frameset code to help with the context within which I am using the accordion menu. The code is all dynamically generated but the example essentials should suffice to illustrate the context.


<frameset cols="177,*" frameborder="no" border="0" framespacing="0">
<frame name='ideas_menu' src='hrefroot +(-1) ideaspgm.ideas_menu_plus.sas' marginheight='0' marginwidth='5' scrolling='auto' noresize>
<frame name='ideas_home' src='/ideas/ideas_home.htm'marginheight='0' marginwidth='0' scrolling='auto' noresize>
</frameset>

Charles55
10-30-2010, 08:36 PM
hello ,
I want to what is this.
Behavior Description: The following syntax causes the href contents to display in the frame that the menu is displayed in. The href being passed uses the target="ideas_home" attribute. This indicates that the function is working to display the href content - just not to the correct frame - seems to be ignoring the target= attribute of the href value.



http://[url =http://www.russellisland.biz/ QLD[/url]