PDA

View Full Version : HV Menu does not appear in frame. Appears without Frame



HellRazor
11-07-2007, 08:52 PM
Using HVMenu 5.5. Looked great as standalone page. Small problem. When I loaded that page into a frame, the menu did not appear. If I refreshed the page, the menu would then appear. Found a solution for that right here, replacing this code

if(Trigger.onload)
{
Dummy=Trigger.onload;
}
Trigger.onload=Go;

with this code

if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", Go, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", Go );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
Go();
};
}
else
window.onload = Go;
}.


All was well.

Then the menu stopped appearing in the frame altogether. Still appears when the page is loaded directly into the browser. I tracked the problem using alerts. The script is dying on this line in IE.

var Doc=Par.document;

And on this line in FireFox

var Bod=Doc.body;

I removed the previous modification, but the problem remains.

Here's the script up to that point.

var AgntUsr=navigator.userAgent.toLowerCase();
var AppVer=navigator.appVersion.toLowerCase();
var DomYes=document.getElementById?1:0;

var NavYes=AgntUsr.indexOf('mozilla')!=-1&&AgntUsr.indexOf('compatible')==-1?1:0;
var ExpYes=AgntUsr.indexOf('msie')!=-1?1:0;
var Opr=AgntUsr.indexOf('opera')!=-1?1:0;
var Opr6orless=window.opera && navigator.userAgent.search(/opera.[1-6]/i)!=-1 //DynamicDrive.com added code
if(Opr){NavYes=1;ExpYes=0;}
var DomNav=DomYes&&NavYes?1:0;
var DomExp=DomYes&&ExpYes?1:0;
var Nav4=NavYes&&!DomYes&&document.layers?1:0;
var Exp4=ExpYes&&!DomYes&&document.all?1:0;
var Exp6Plus=(AppVer.indexOf("msie 6")!= -1||AppVer.indexOf("msie 7")!= -1)?1:0
var PosStrt=(NavYes||ExpYes||Opr)&&!Opr6orless?1:0;
var P_X=DomYes?"px":"",FHtml=null,ScHtml=null,FCmplnt=0,SCmplnt=0;
var FrstLoc,ScLoc,DcLoc;
var ScWinWdth,ScWinHght,FrstWinWdth,FrstWinHght;
var ScLdAgainWin;
var FirstColPos,SecColPos,DocColPos;
var RcrsLvl=0;
var FrstCreat=1,Loadd=0,Creatd=0,IniFlg,AcrssFrms=1;
var FrstCntnr=null,CurrntOvr=null,CloseTmr=null;
var CntrTxt,TxtClose,ImgStr;
var Ztop=100;
var ShwFlg=0;
var M_StrtTp=StartTop,M_StrtLft=StartLeft;
var StaticPos=0;
var M_Hide=Nav4?'hide':'hidden';
var M_Show=Nav4?'show':'visible';

var Par=parent.frames[0]&&FirstLineFrame!=SecLineFrame?parent:window;

var Doc=Par.document;
var Bod=Doc.body;
var Trigger=NavYes&&!Opr?Par:Bod;

I re-iterate, it ran fine, even with frames, for 24 hours, then it conked out, and it won't run in the frame at all.

Any ideas?

molendijk
11-07-2007, 09:52 PM
You can use the non-frameset HV menu (the one that's not specially designed for framesets) for framesets!
Look at the technique explained here (http://www.dynamicdrive.com/forums/showthread.php?t=25009&highlight=molendijk) for the way to do it. When you follow the instructions, the problem you talk about will not present itself anymore.

Arie Molendijk.

HellRazor
11-08-2007, 09:59 PM
molendijk - I tried your techique and it certainly eliminates the problem! I am running into another one however. The correct page loads on the first menu click. But on subsequent clicks, nothing happens! I have the target url appearing in the status on Mouseover, and it seems to be correct, but when I click .... nada.

I believe I followed your directions closely. I did use <base target="content"> (content being the name of the target frame.) The menus are certainly appearing.

One peculiarity, the menu seems to be painted twice when it first loads! That is to say, it seems to be painted again over the first time, about 30 pixels to the right. After the first mouse click, the second menu vanishing, and there's only one, which only works for links NOT going into the target frame.

That is to say, the following works....

javascript: top.location.href ='http://intrapar1/..../index.htm'

While this doesn't ...

javascript: parent.content.location.href ='http://intrapar1/..../index.htm'

Both work properly if they are the first click.

molendijk
11-08-2007, 11:55 PM
Are you sure you've eliminated everything that 's related to the frameset use of the HV Menu? For instance, do you have this now?:
var DocTargetFrame="";
var MenuUsesFrames=0;

Perhaps you could give me a link to your site?

Arie M.

(I made a demo, see next post)

molendijk
11-09-2007, 01:19 AM
I made a quick demo for you, based on an old HV menu that features in DynamicDrive. It's located here (http://www.let.rug.nl/~molendyk/demo_versluis).
I had to make some weird provisional changements in exmplmenu_var.js (that's the menu here) in order to force the pages to open in the main page's frame (name: 'main' here). Also, you have to click on the TEXT in the subitems in order to open the pages. That should be corrected. Examine for yourself. But you can see that it works, in a (provisional) way (even with foreign pages). There a link for download. Good luck.

Arie Molendijk.

HellRazor
11-09-2007, 01:48 PM
Are you sure you've eliminated everything that 's related to the frameset use of the HV Menu? For instance, do you have this now?:
var DocTargetFrame="";
var MenuUsesFrames=0;

Perhaps you could give me a link to your site?

Arie M.

(I made a demo, see next post)
The site in question, regrettably, is an intranet. It's not accessible from outside. I'll double check on the 'frameset use of the HV Menu' code.

BTW, thank you for being so helpful.

molendijk
11-09-2007, 01:54 PM
No problem.
Anyway, the demo (see previous post) I posted seems to work now, see here (http://www.let.rug.nl/~molendyk/demo_versluis/).

Good luck,
Arie M.

HellRazor
11-09-2007, 02:50 PM
I made a quick demo for you, based on an old HV menu that features in DynamicDrive. It's located here (http://www.let.rug.nl/~molendyk/demo_versluis).
I had to make some weird provisional changements in exmplmenu_var.js (that's the menu here) in order to force the pages to open in the main page's frame (name: 'main' here). Also, you have to click on the TEXT in the subitems in order to open the pages. That should be corrected. Examine for yourself. But you can see that it works, in a (provisional) way (even with foreign pages). There a link for download. Good luck.

Arie Molendijk.Hmmmm .... what do you mean by 'weird provisional changements'. The exact problem I'm having is getting pages to open in the main pages frame.

HellRazor
11-09-2007, 02:56 PM
One other thing. You mentioned removing the code related to frames. There's actually quite a bit of that. Did you actually mean 'all', or am I looking for something specific?

Most of the code I tried removing resulted in the menu not displaying at all.

HellRazor
11-09-2007, 03:41 PM
I'm studying your example now. Good stuff.

molendijk
11-09-2007, 04:06 PM
What I ment by 'weird provisional changements' is that in order to accomplish what you want (open pages in main frame), I had to write things in the HV menu 'my way' i.e. not the way ment by the HV-author.
Anyhow, everything seems to function properly now. You can even have foreign pages in the main frame (Google) that are under the unfolding subitems.
As for what I said about the code related to frames, forget about it. It was only a wild guess.

Good luck,
Arie M.

HellRazor
11-09-2007, 04:54 PM
I noticed an interesting thing in your code. Your menus are written

new Array("<a style='color:black;text-decoration:none;position:absolute;width:150' href='http://www.google.com' target='main'>&nbsp;Google</a>","","",0,20,150);

The ones from DD were written

new Array("Google","http://www.google.com","",0);

The difference being that you have a link in the first array position, and null in the second array position. They have display test in the first position, and a url in the second array position. Is that critical to making this work?

The project I'm working on actually uses display text in the first position, and javascript in the second position

new Array("Google","javascript:parent.content.location.href='http://www.google.com'","",0);

The referal to the frame 'content' is failing to eval in IE, and resolves to the whole browser in FireFox. Do you think that could be the problem?

HellRazor
11-09-2007, 05:42 PM
What I'm finding is that your method work very well when the target pages are in the same subdirectory as the menu, but when I refer to pages on other server (http:intranet/apples/macIntosh/display.htm for example) the pages don't display on IE, and use the whole browser instead of going to the target window when using FireFox.

If I code it the way DD had it, with display text in the first array element, and the url inthe second array element, it works too. As long as the pages are in the local subdirectory. unfortunately, I can't re-locate the target pages.

molendijk
11-09-2007, 06:42 PM
/The difference being that you have a link in the first array position, and null in the second array position. They have display test in the first position, and a url in the second array position. Is that critical to making this work?/
Yes, that's critical.
-------------
/What I'm finding is that your method work very well when the target pages are in the same subdirectory as the menu, but when I refer to pages on other server (http:intranet/apples/macIntosh/display.htm for example) the pages don't display on IE, and use the whole browser instead of going to the target window when using FireFox./
That I don't understand, since I get Google in the main frame; Google and the menu are not in the same directory.

Arie M.

molendijk
11-12-2007, 07:52 PM
I started a new thread about HV menus in framesets. It might be useful. The link is here (http://www.dynamicdrive.com/forums/showthread.php?t=26564).

Arie Molendijk.

HellRazor
11-14-2007, 11:51 AM
Thank you so much for all your help on this.