Javascript Menu-Probleem...

Pagina: 1
Acties:
  • 40 views sinds 30-01-2008

  • djdadevil
  • Registratie: Mei 2005
  • Laatst online: 28-02 09:12

djdadevil

sid: 133620

Topicstarter
Dag mede-"programmeurs" en anderen...

Ik heb een klein probleempje, ah fin, probleem, eerder een vraag... Ik heb eens een hele tijd geleden een zogenoemd javascript-tree menu gedownload van iemand.. heb het nooit gebruikt maar ben er eens mee aan de slag gegaan... Nu is het echter zo dat dit een menu is wat met 1 externe file werkt... het menu wat dit script opbouwt zich in 1 frame bevind, en voor een actie in 2 frames zorgt...

Ah fin... mijn vraag/probleem dan... dit is een gedeelte van het script:
// Write Home Menu
if (page=='home') {
thisMenu = new Array();
thisMenu[0] = new subMenu('Wie Zijn Wij','wiezijnwij.htm');
thisMenu[1] = new subMenu('Wat Doen Wij','watdoenwij.htm');
thisMenu[2] = new subMenu('Waarom Wij','waaromwij.htm') ;
}

// Write Links Menu
if (page=='Links') {
thisMenu = new Array();
thisMenu[0] = new subMenu('Links','Links.htm');
thisMenu[1] = new subMenu('Banner Exchange','Banner.htm');
}

// Write Adressen Menu
if (page=='Adressen') {
thisMenu = new Array();
}
Om even kort uit te leggen wat bovenstaand doet...
een stukje van het menu.

Home
Adressen
Links

nou, zodra men op Home klikt opent er zich een submenu met de items Wie zijn wij, Wat doen wij, en Waarom wij?
Zodra dan op een van die items geklikt word word er in het naaststaand frame de daarna gespecificeerde pagina geladen...

Nu is het echter zo dat het script waarvandaan ik dit heb, enkel uitgaat van een menu met sub-menu's en daar pas de pagina's koppelt... vandaar dat Adressen eigenlijk nu geen functie heeft.

Nu wil ik echter (de vraag/probleemstelling) dat dit menu zodra ik op Adressen klik zich niet een submenu opent (heeft hij namelijk ook niet), maar meteen een pagina in naaststaand frame opent... dus op de manier zoals een submenu dat doet...

Verder wil ik met name op de Home knop heel graag dat zowel het submenu zich opent maar ook weer tegelijkertijd een pagina inlaad.... (hoop dat jullie snappen wat ik bedoel!)

Nu is mijn kennis in javascript echter niet zó super en wil ik dus graag weten hoe dit script er op die manier uit komt te zien dan. Iemand die me daarmee kan helpen misschien???

Don't Stop That Body Rock, Don't Stop That Party!


  • Kayshin
  • Registratie: Juni 2004
  • Laatst online: 09-03-2018

Kayshin

Bl@@T @@P!!!

Kan je misschien het gebruikte script posten? Kunnen we iets meer mee, we weten nu niet echt hoe het script verder werkt.

Ik denk dat je dan op dat bepaalde item een onclick event moet zetten dat naast het submenu ook nog in je andere frame een pagina opent. Dit doe je heel simpel met een top.framename.href=.

Ik denk dat je dan tegelijk je eerste vraag beantwoord hebt: Als hij dan toch geen submenu opent, gooi je gewoon een onclick op dat ding en opent hij een pagina in dat andere frame.

My personal videoteek: -Clique-; -NMe- is een snol!


  • djdadevil
  • Registratie: Mei 2005
  • Laatst online: 28-02 09:12

djdadevil

sid: 133620

Topicstarter
Oké... komtie dan:

dit is wat er in index.html staat (en index.html bestaat dan uit 3 frames:)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>EDITED</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<frameset rows="*" cols="150,*" frameborder="NO" border="0" framespacing="0">
<frame src="menu.html" name="leftFrame" scrolling="NO" noresize>
<frameset rows="37,*" cols="*" framespacing="0" frameborder="NO" border="0">
<frame src="top.htm" name="topFrame" scrolling="NO" noresize>
<frame src="home.htm" name="mainFrame">
</frameset>
</frameset>
<noframes><body>
</body></noframes>
</html>
Volgende is wat er in menu.html staat (dus waar het script het menu genereert)
<html>
<head>
<title>EDITED</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="jsmenu/style.css" type="text/css">
<script language='JavaScript' src='jsmenu/jsmenu.js'></script>
<script language='JavaScript'>

function openMenu(cat) {
this.cat = cat;
document.write('<span class = "level1">');
document.write('<a href = "' + thisPage + '?page=null" target="_self">');
if (lev1img=='yes') {
document.write('[img]"'[/img]');
}
document.write(cat + '</a><span><br>');
for (x=0;x<thisMenu.length;x++){
document.write('<span class = "level2">');
if (lev2img=='yes') {
document.write('[img]"'[/img]');
}
if (lev2Char=='yes') {
document.write(bullet);
}
document.write('<a href="' + linka + thisMenu[x].linkb + '">' + thisMenu[x].name + '</a><span><br>');
}
}

// closes menu section - do not alter
function closeMenu(cat,pass) {
this.cat = cat;
this.pass = pass;
document.write('<span class = "level1">');
document.write('<a href = "' + thisPage + '?page='+pass+'" target="_self">');
if (lev1img=='yes') {
document.write('[img]"'[/img]');
}
document.write(cat + '</a><span><br>');
}
</script>

<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
}
.style3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
color: #999999;
}
a:active {
color: #000000;
text-decoration: none;
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
}
.style4 {
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
color: #999999;
}
.style5 {
font-size: 9px;
font-style: italic;
color: #999999;
}
.style8 {font-size: 9px}
.style9 {font-size: 10px}
.style10 {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: italic;
color: #999999;
}
.style13 {color: #999999}
.style14 {font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; color: #999999; }
html {
overflow-x: hidden;
overflow-y: auto;
}
-->
</style>
</head>
<body bgcolor="#FFFF99" text="#000000"><br><br><br>
<br>
<script language="JavaScript">

if(page=='home') {
openMenu('Home');
} else {
closeMenu('Home','home');
}

if(page=='Links') {
openMenu('Links');
} else {
closeMenu('Links','Links');
}

if(page=='adressen') {
openMenu('Adressen');
} else {
closeMenu('Adressen','adressen');
}

</script>
</body>
</html>
Let niet op de slordigheid, excuses daarvoor!

Dan is onderstaand jsmenu.js wat in bovenstaand bericht genoemd word wat mijn menu opbouwt:
<!--
// *****************************************************************************
// ** SETTINGS **
// *****************************************************************************

// 'linka' use this if part of the URL is the same in ALL the links
// In this example all the files are in a subfolder called 'pages'
linka='pages/';

// the filename of the page the menu appears in eg 'menu.html'
thisPage='menu.html';

// Do you want to use images for the category bullets?
// If so then specify the path to your images folder from the menu page
imgPath='images/';

// do you want to use images for the category bullets?
lev1img='yes'; // insert yes or no

// give image names and dimensions
lev1OpName='open.gif'; // open image name
lev1OpHeight='10'; // image height
lev1OpWidth='10'; // image width

lev1ClosName='closed.gif'; // closed image name
lev1ClosHeight='10'; // image height
lev1ClosWidth='10'; // image width

// do you want to use images for the sub-category bullets?
lev2img='yes'; // insert yes or no

// give image names and dimensions
lev2Name='bullet.gif'; // image name
lev2Height='10'; // image height
lev2Width='16'; // image width

// do you want to use a text character for the sub-category bullets?
lev2Char='no'; // insert yes or no

// set bullet character for level 2 bullets
bullet = '&#155; ';

// base target - the frame that the links are targetting
base = 'mainFrame';

// *****************************************************************************
// ** END OF SETTINGS **
// *****************************************************************************

// pulls 'page' variable out of URL - do not alter
var x = 0
page = location.search.substr(1).split("?")
for (x=0;x<=page.length;x++) {
eval(page)
}
page = escape(page);
page = page.slice(7);

// do not alter this bit
function subMenu(name,linkb) {
this.name = name;
this.linkb = linkb;
}
document.write('<BASE target="' + base + '">');

// *****************************************************************************
// ** BUILD MENU DATA **
// *****************************************************************************

// Write Home Menu
if (page=='home') {
thisMenu = new Array();
thisMenu[0] = new subMenu('Wie Zijn Wij','wiezijnwij.htm');
thisMenu[1] = new subMenu('Wat Doen Wij','watdoenwij.htm');
thisMenu[2] = new subMenu('Waarom Wij','waaromwij.htm') ;
}

// Write Links Menu
if (page=='Links') {
thisMenu = new Array();
thisMenu[0] = new subMenu('Links','Links.htm');
thisMenu[1] = new subMenu('Banner Exchange','Banner.htm');
}

// Write Adressen Menu
if (page=='adressen') {
thisMenu = new Array();
}

//-->
Dat is alles, misschien iemand die me dan kan helpen... ben thuis in Actionscripting, HTML, CSS en beetje PHP/MySQL... maar totaal niet in javascript...

Don't Stop That Body Rock, Don't Stop That Party!


  • djdadevil
  • Registratie: Mei 2005
  • Laatst online: 28-02 09:12

djdadevil

sid: 133620

Topicstarter
Niemand die mij kan helpen met bovenstaand wat ik wil??? :'(
_/-\o_ voor diegene die me kan en wil helpen....

Don't Stop That Body Rock, Don't Stop That Party!


Verwijderd

Ik wil je inderdaad niet helpen. Ik zal even uitleggen waarom niet. Jij download een script en hebt het dus niet eens zelf gemaakt. Jij hebt een probleem en gooit gewoon de code op het forum met de boodschap: wie helpt me even?
Wij die hier op het forum zitten en javascript wel snappen hebben ook tijd en moeite moeten investeren in onze kennis. We verwachten dat jij ook een klein beetje moeite neemt. Je toont net te weinig initiatief.
Daar komt bij dat de maker van het menu jou veel sneller en beter uit kan leggen hoe het menu werkt. Je moet voor vragen over het menu dus bij hem zijn.
Als laatste zijn er weinig mensen die 100+ regels code gaan bekijken. Het is altijd de bedoeling dat je slechts relevante stukken code post zodat wij niet in jou code hoeven te graven.

Dit allemaal opgeteld is de reden waarom niemand een reactie plaatst.

  • djdadevil
  • Registratie: Mei 2005
  • Laatst online: 28-02 09:12

djdadevil

sid: 133620

Topicstarter
Ik zal het uitleggen... ik heb de schrijver van die code al gemaild (is een Engelander... 3x raden wat ik terug krijg... ik quote rechtstreeks vanuit die e-mail (alles, met hier en daar beetje ge-edited, schrik dus niet, tis om het hele verhaal duidelijk te maken waarom ik jullie vraag aangezien mijn specialiteiten op andere programmeer talen liggen): check de datums overigens van die mails... zie je dat ik er al bijna een jaar mee bezig ben... :(, en excuses als dit als een te lange post word gezien!!!
mag dit ook overslaan als je het bovenste alleen al leest!
Begin onderaan!

!>!>!>Hi,
!>!>!>
!>!>!>I'm afraid the menu was never designed to do what you want. Without
!>!>!>rewriting the script this isn't possible.
!>!>!>
!>!>!>Regards,
!>!>!>Simon.

Mark wrote:

> Don't Get It,
>
> look at my menu page's html code:
> (read further below the script!)
> -----------------------------------
EDIT: (Script van menu.htm, net als in mijn bovenstaande post)
> -----------------------------------
>
> Don't mind the dutch words, but Home nowadays opens up with 3 options
> below, but I also wan't when Home is clicked not only to open up those
> 3 submenu's, but also load the default page of the website.
>
> Other words like the last option //write Zoeken Menu, don't need to
> open up submenu's but only open up an page in the mainFrame.
>
> Here's my config for the jsmenu.js:
>
> -----------------------------------
EDIT: (script van jsmenu.js, net als in mijn bovenstaande post)
> -----------------------------------
>
> Now please tell me we're exactly to put that link... cause I don't see it.
> I wanna know the option when a menu item is clicked, only a page is
> loaded into the mainFrame without any submenu's, ánd the option for
> when a menu item is clicked, a submenu is openend (wich do open up
> pages by default) and at the same-time open up an page in the
> mainframe... like Home does, examples:
>
> -Home
> - Who Are We
> - What Do We Do
> (When Home is clicked the submenu's should open up and at the same
> time a page in the mainframe for Home should be opened up.)
>
> ánd:
>
> - Search
> (no submenu's)
> (When Search is clicked no submenu's open, only a page is loaded into
> the mainframe.)
>
> please help me out... cause I can'g get any further without those 2
> options added to the menu!
>
> So waiting in advance for answer... I remain!!!
>
> Hope to hear from you soon!
>
> Your Sincerrely,
> Mark
> The Netherlands
>
> ----- Original Message -----
> From: "Simon Rycroft" <EDITED>
> <mailto:EDITED>>
> To: "Mark" <EDITED>
> Sent: Thursday, March 17, 2005 6:25 PM
> Subject: [Norton AntiSpam] Re: The JavaScript Tree Menu by Net
> Explorers Ltd Information svp
>
> > Hi,
> >
> > Just create a standard html link above where the javascript code
> appears
> > in the menu page.
> >
> > Simon.
> >
> > Mark wrote:
> >
> >> Dear Simon Rycraft,
> >>
> >> A long time agoo I e-mailed you about a question I've had about the
> >> JaveScript Tree Menu by Net Explorers Ltd, the question wich in fact
> >> is a problem nowadays is coming along with this e-mail (all older
> >> messages from those days are standing below) so you remember it
> >> again... And now my question since it's a long time now... do you have
> >> my answer???
> >>
> >> in short again:
> >> here is a section of the menu wich I only want Home not to open a
> >> submenu but directly a page into the right frame:
> >>
> >> /Home
> >> Stringed Instruments
> >> Strum Instruments
> >> /etc etc."
> >>
> >> Waiting in advance for answer, I remain,
> >>
> >> Your Sincerely,
> >>
> >> Mark
> >> The Netherlands
> >>
> >> ----- Original Message -----
> >> *From:* Mark <EDITED>
> >> *To:* Simon Rycroft <EDITED>
> >> *Sent:* Friday, August 27, 2004 12:34 AM
> >> *Subject:* Re: The JavaScript Tree Menu by Net Explorers Ltd
> >> Information svp
> >>
> >> Alright, great that my English is understandeble (I think this is
> >> spelled wrong but what the heck, you'lle get it I suppose),
> >>
> >> than; Did you already reminded the answer to my question?¿? Otherwise
> >> tell me on wich point you are... (e.g. waiting for another one,
> >> searching the answer yourself?) To quickly repeat my question about
> >> the JaveScript Tree Menu by Net Explorers Ltd: "here is a section of
> >> the menu wich I only want Home not to open a submenu but directly a
> >> page into the right frame:
> >>
> >> /Home
> >> Stringed Instruments
> >> Strum Instruments
> >> /etc etc."
> >>
> >> Again waiting (and already thanking for your help) in advance for
> >> answer, I remain,
> >>
> >> Your Sincerely,
> >>
> >> Mark
> >> The Netherlands
> >>
> >> ----- Original Message -----
> >> *From:* Simon Rycroft <EDITED>
> >> *To:* Mark <EDITED>
> >> *Sent:* Tuesday, August 24, 2004 10:17 AM
> >> *Subject:* Re: The JavaScript Tree Menu by Net Explorers Ltd
> >> Information svp
> >>
> >> Hi Mark,
> >>
> >> I'll get back to you later today.
> >>
> >> Don't worry - your English is great and I have no trouble
> >> understanding you.
> >>
> >> Regards,
> >> Simon.
> >>
> >> On Monday, August 23, 2004, at 04:10 PM, Mark wrote:
> >>
> >> Hi Simon,
> >>
> >> The delay isn't really a probem, I give up after 5 day's no
> >> respond and send a new so called remembering e-mail... But you
> >> were in time... And I'm very glad you get back to me, when you
> >> figured this out... cause I already saw it's an old script
> >> (but still working great), and I absolutly have no idea on how
> >> to open a page directly into the right frame. I'm an
> >> ICT-Consultant in education, but my webdesign features are
> >> from own learning... and javascripts I can read, but not make
> >> them out of my head... And there-fore I e-mailed you in the
> >> hope someone could give me an answer... And if you have, I'm
> >> very glad if you shared it with me. Well... it lookes clear to
> >> me the information I need... and otherwise I direct you to the
> >> mail I already sent you. I understand the dissapearing of that
> >> database but still hope you can remember. It would be very
> >> helpful for me. Well, many thanks in advance and in waiting of
> >> an answer, I remain.
> >>
> >> Your Sincerely,
> >>
> >> Mark
> >> The Netherlands
> >>
> >> ps: Don't watch the English... I'm an foreigner and try to do
> >> my best... and although languages are being changed with so
> >> called sms, MSN, and chatting-languages I sometimes forget
> >> normal English words. My apologies!
> >>
> >> ----- Original Message -----
> >> *From:* _Simon Rycroft_
> >> *To:* _Mark_
> >> *Sent:* Monday, August 23, 2004 1:39 PM
> >> *Subject:* Re: The JavaScript Tree Menu by Net Explorers Ltd
> >> Information svp
> >>
> >> Hi Mark,
> >>
> >> Sorry for the delay.
> >>
> >> We used to have some discussion forums for this script but the
> >> company hosting the site was bought out and our database
> >> disappeared. Someone in the forums managed to work out how to
> >> do this but I can't remember. Let me have a think and I'll et
> >> back to you.
> >>
> >> Simon.
> >>
> >> On Friday, August 20, 2004, at 06:37 PM, Mark Houben wrote:
> >>
> >> Hi there,
> >>
> >> I've got a question about a script I've got some time ago
> >> (I've putted it in a attachment for you!) from your website...
> >> It's about the javascript tree menu by Net Explorers Ltd. I'm
> >> working with this menu and I was wondering if/ /I could
> >> directly open a page in the right frame without opening a
> >> sub-menu. If so... could you send me the specified rule wich
> >> should come after e.g. "// web Design Menu if (page=='home')".
> >> and to give you an idea wich I want to do with this, here is a
> >> section of the menu wich I only want Home not to open a
> >> submenu but directly a page into the right frame:
> >>
> >> /Home
> >> Stringed Instruments
> >> Strum Instruments
> >> /etc etc.
> >>
> >> Waiting in advance for answer, I remain,
> >>
> >> Your sincerely,
> >>
> >> Mark
> >> The Netherlands
> >> <The JavaScript Tree Menu by Net Explorers Ltd.zip>
> >>
> >>
> >> Simon Rycroft
> >> Net Explorers Ltd
> >>
> >> -----------------------------------------
Dan boven dit alles nog eens het feit dat ik in mijn eerste post 1 klein stukje van de code schrijf waar het hoogstwaarschijnlijk om gaat, ik de vraag van iemand krijg om hem helemaal te posten ik hem post, en dan "..." krijg van anderen dat ik dat niet moet doen... READ the messages eerst voordat je commentaar geeft op een wat lang stuk code!

Moest er ff uit... sorry!

Bij deze dus nogmaals... hoop dat IEMAND me kan helpen...

Don't Stop That Body Rock, Don't Stop That Party!


Verwijderd

djdadevel > Ik vind het kut voor je dat al zo lang bezig bent met dit probleem. Tweakers is alleen bedoelt voor mensen die zelf hun probleem oplossen. Als je in dat jaar de moeite had genomen om een boek over javascript te lezen, dan had je het probleem al lang kunnen oplossen.
De auteur geeft zelf al aan dat het script grotendeels gewijzigd moet worden. Je kan niet van ons verwachten dat wij jou "even een scriptje" geven. We willen je best helpen als je ergens niet uitkomt, maar dan moet je wel enige kennis van zaken hebben en zelf initiatief tonen (qua programmeren).

  • Pelle
  • Registratie: Januari 2001
  • Laatst online: 13:58

Pelle

🚴‍♂️

Sorry, maar scriptrequests doen we niet aan :)
Pagina: 1

Dit topic is gesloten.