snikerz79
05-05-2003, 02:50 AM
I have a code for a javascript menu which I really like. Now I just need to figure out what to edit and to edit it to what. Here is the part of the code which I believe you change depending on where you want it:
function openMenuItem(sc) {
if (sc==51) {
window.open(getMenuItem(sc));
} else {
if (sc==52) {
window.open(getMenuItem(sc));
} else {
if (sc==54) {
window.open(getMenuItem(sc));
} else {
top.daf_mains.daf_main.location.href = getMenuItem(sc);
}}}
MaGiCSuN
05-05-2003, 10:25 AM
nope that's not the part. Maybe you can post the whole code or the site where you got the code from? thanks !
Love,
Mirna
Stormx
05-05-2003, 01:55 PM
All that does is test if the variable "sc" is either 51, 52, 54 or somthing else and acts apon those commands. As far as i can see it has nothing to do with framesets. What site are you getting it from (like magic sun said)?
amicus
05-05-2003, 07:06 PM
i'm not sure but if you are trying to open a page inside your frameset the easiest way is to use the target attribute.
<A HREF="page.html" TARGET="frameName">text</A>
snikerz79
05-05-2003, 07:43 PM
Here's more of the code.
<style>
.menu {position:relative;background-color:black;color:white;border:0px solid black;width:150;font-size:11px;font-family:verdana;position:absolute;cursor:hand;}
.item_panel{width:150;border-left:0px solid black;border-right:0px solid black;clip:rect(0,150,0,0);position:absolute;}
.item_panel a{text-decoration:none;color:#a5b4cb;cursor:default;}
.item{background-color:#111111;width:148;font-size:10px;font-family:verdana;}
</style>
<script language="JavaScript">
function getMenuItem(mi) {
if (mi==11) {mir='main.html'}
else if (mi==12) {mir='updates.html'}
<script language="JavaScript">
var Link = new Array();
Link[0] = "0|Information";
Link[1] = "1|Home|11|daf_main";
Link[2] = "1|Updates|12|daf_main";
MaGiCSuN
05-05-2003, 07:52 PM
could you please post the whole code from the menu? because that one is not finished that you posted as the last one :S
Love,
Mirna
snikerz79
05-05-2003, 08:02 PM
the last code goes on and on for a few more links.
amicus
05-05-2003, 08:09 PM
if the javascript is to large can you tell us what it's suppose to do and what you want to do on your page.
snikerz79
05-05-2003, 08:13 PM
Lol. Well, its a menu javascript menu which opens up in a heirarchal fashion. I was told by the person I got it from that the daf_mains after the links in the link area is the frame that you want it to go to. The only problem is, is the very first part I posted here. The last line of the if statement causes me to get a javascript error. You can see the menu working here: upc.the-cell.co.uk/menu.html
It won't open to a new frame which is the only problem.
amicus
05-05-2003, 08:44 PM
i've just got done looking at the page you gave us. it looks like the error is coming from the frames. what's happening is that you have a frame inside of a frame. on line 49 'top.daf_mains.daf_main.location.href = getMenuItem(sc);' it's traversing the frames:
top (top most frame)
daf_mains (out frame)
daf_main (inner frame)
location
href = getMenuItem(sc);
then it goes to the page.
i setup the required frames with the names and it worked. depending on what you want you'll need to change the function getMenuItem(mi) like:
else if (mi==34) {mir='story/ch1.html'} (original)
else if (mi==34) {mir='url'} (changed)
the important thing is you give it the frames it needs or just remove one of the frame names from the line 49.
hopefully i understood and this fixes it.
snikerz79
05-06-2003, 01:51 AM
ok, so i have just one frame that the entire stuff is going into. its called Main, so what do i change?
amicus
05-06-2003, 03:10 AM
i checked back at your site and you've made some changes :) we're getting closer :) i think you want to put this into a frameset with the menus on the left and the body on the right. the right frame needs to be called 'main' (lowercase 'm') then once you click on the menu items on the left it'll open in the right.
all you need to change are the url's in the lines that look like the ones below:
if ( mi == 11 ) { mir = 'http://www.yourdomain.com'; }