PDA

View Full Version : Go menu link to I-frame



navaldesign
02-09-2006, 12:11 AM
Hi everybody,

Radek, a member of the forum, has asked for a way to link the options in a Go menu, to an I-frame. Indeed, this is something not provided as a standard feature in the Go menu.

Well, here's the solution:

1. Create the Go menu as usual. Put in it all the required options and for each option give the necessary URL.

2. Move your Go menu, at the very top left corner of the page.

3. Right click on it and go to Object html. Copy the code that will look like:


<FORM name="GoMenuForm2" action="">
<SELECT name="GoMenu" style="width:119px">
<OPTION selected>Select a link</OPTION>
<OPTION value="http://www.yoursite.com/page_in_the_frame1.html>option1</OPTION>
<OPTION value=http://www.yoursite.com/page_in_the_frame2.html>option2</OPTION>
</SELECT>
<INPUT type="button" value="Go" onclick="OnGoMenuForm2Link()">
</FORM>
<SCRIPT language="JavaScript" type="text/javascript">
function OnGoMenuForm2Link()
{
var url = document.GoMenuForm2.GoMenu.options[document.GoMenuForm2.GoMenu.selectedIndex].value +"";
if (url != '')
{
if(parent != self)
{
var doc = self;
while(doc != window.top)
{
doc = doc.parent;
}
if(url.indexOf("://")!=-1)
{
doc.body.window.location.href = url;
}
else
{
window.framename.location.href = url;
}
}
else
{
window.framename.location.href = url;
}
document.GoMenuForm2.GoMenu.selectedIndex=0;
}
}
</SCRIPT>


Replace the blue text (which is originally "top") with the name of your frame, here called "framename".

Insert a HTML box. Double click it to edit it, and paste in the html box the code you have copied.This will create a new Go menu in your page, with the links you have originaly given it, but now it will open the linked page in the iframe.

Delete the original Go menu. You're done!

Please feel free to try it at http://www.navaldesign.info/Tips/goinframe.html

The reason that i told you to move the Go menu in the upper left corner, is that in this way you obtain top and left margins 0. So now you can move the html box anywhere in your page. The whole procedure takes 3 minutes but you obtain a result that cannot be done directly in BV.

A small tip: If before deleting the original Go menu, you make the html box the same size as your original Go menu, using the Make Same Size tool, it will be much easier to have a visual control when you will need to position it in the correct position.

P.S. In the wish Bin there is a poll regarding the Tips & Tricks Section that you're reading right now. Please take just 30 secs to express your opinion. The poll is at the top of this thread: http://www.vodahost.com/vodatalk/wish-list-idea-bin/4050-tips-section-forum.html

Thanks!