Netwars

Menu na WWW

[#1]
15.10.2004 13:04

Czy ktoś wie, ma jakiegoś tutoriala etc, jak na stronie zrobić, zeby z danego guzika wysówało sie menu ??

http://q-net.com.pl/ - przykład.

Chodzi mi jendak o to, zebym mogl ingerować w to menu z poziomu skryptu, a nie z poziomu kazdej strony z osobna. Pozdrawiam.

[#2]
15.10.2004 13:04

Aha. Podomne menu jest na stronie WC3 netwarsa. POzdro i z gory thx

[#3]
15.10.2004 13:10

toż to jest java czysta prawda koeldzy HTML'owcy :D?

[#4]
15.10.2004 13:12

Ta, mozna tez zrobic to we flashu.

[#5]
15.10.2004 13:12

"Cool menus" chyba tak nazywal sie ten skrypt. Poszukaj na hotscripts.com

[#7]
15.10.2004 13:53

Genarlnie OK, tylko ja to chce podczepić, pod już istniejące guziki. I nie mam pojęcia jak to zrobić :D

[#9]
15.10.2004 23:21

Jakie guziki? Edytujesz kod i zmieniasz linki.

[#10]
15.10.2004 23:50

polecam cagretowskie mygosumenu:

http://gosu.pl/dhtml/mygosumenu.html

malutkie, zgrabniutkie, dobrze napisane. dodac moge, ze na iCOMP.pl uzylem wlasnie tego menu, polecam komus, kto nie ma czasu/checi pisac swojego, a chce miec dobre menu.

[#11]
15.10.2004 23:51

"toz to jest java"

To zajrzyj na kursy php -_-V

[#12]
16.10.2004 11:56

Dzieki solo. Twoje menu tez jest OK, ale ma ten minus ze edytuje sie je z poziomu danej strony HTML. Ja bede dodawał czesto rozne opcje dlatego nie chcialo by mi sie ciagle zmieniać 20 stron :D.

A problem z tamtym mam taki, ze mam strone z guzikami. Wstawiłem to menu, ale chce zrobić, zeby jak najade na moj guzik to wyjezdzały te opcje, a nie zeby było gotowe menu tak jak narazie mam :(

[#13]
16.10.2004 12:49

Wieczorkiem Ci skrypt napisze k ?
--
Retro.czop

[#14]
16.10.2004 13:18

To w koncu chodzi ci o menu rozwijane takie jakie ja podałem czy o listing ktory zapodał Solo??

Jak nie chcesz edytowac w 20 stronach to zrob sobie jeden plik, wrzuc do niego kod tego twojego menu i załącz do kazdego z 20 plikow. Bedziesz edytowal tylko w tym jednym pliku a zmiany zobaczysz wszedzie. Ale musisz miec php na serwerze.

[#15]
16.10.2004 13:31

lukas mozesz napisac jak to sie robi? :O

[#16]
16.10.2004 15:36

Roger czy o cos takiego Ci choidziło? :

<!-- Notes: Netscape 6 will not scroll when this script is used as a js file? -->

<!-- 3 steps to follow -->

<!-- 1:Put this stylesheet in to the head of your page.
This sets the colour for the links in the drop down
menus. Does not effect other links! -->

<style type="text/css">
<!--
a.x:link, a.x:visited, a.x:active{color:#ffffff;text-decoration:none}
//-->
</style>

<!-- 2: Use this as your body tag. Add your own bgcolor, link(standard), text colours etc.
Alter the margins accordingly. -->

<body marginheight="25" topmargin="25">

<!-- 3: Paste the script as last thing in body of your page. -->

<script language="javascript">
<!-- Simple NavBar 2 - http://website.lineone.net/~kurt.grigg/javascript

//!!!Edit the appearance here!!!

MenuWidth=170; //Individual menu width.
MenuFont='Arial,Verdana';
MenuFontSize=2; //1 to 7 only, 2 probably big enough.
MenuFontColor='#ffffff';
MenuBgColor='#5b7693';
HighLight='#b4c3d4';
Separater=2; //Space around menus.
Centre=true; //true or false.

//!!!Alter nothing here, go straight to "Links"!!!

n4=(document.layers);
n6=(document.getElementById&&!document.all);
ie=(document.all);
h=(ie)?document.body.clientHeight:window.innerHeight;
w=(ie)?document.body.clientWidth:window.innerWidth;
Titles=new Array()
Links=new Array()

algn1=(Centre)?'<center>':'';
algn2=(Centre)?'</center>':'';

function colour2(c){(n4)?c.bgColor=HighLight:c.style.background=HighLight}//
function colour1(c){(n4)?c.bgColor=MenuBgColor:c.style.background=MenuBgColor}//

var OpenLayer=(n4)?"<br><layer height=100% width=100% onMouseOver='colour1(this)'; onMouseOut='colour2(this)'>"+algn1:"<div style='height:auto;width:100%' onMouseOver='colour1(this)'; onMouseOut='colour2(this)'><font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">";
var CloseLayer=(n4)?algn2+"</layer>":"</font></div>";

var vs=(n4)?"<font face='Wingdings' color="+MenuBgColor+">n</font>":OpenLayer+"&nbsp;"+CloseLayer+"<font color="+MenuBgColor+">"+String.fromCharCode(9660)+"</font>";

/*************************************Links here****************************************

First off, alter the Titles to whatever. Add/delete as needed, make sure they're
numbered in order.

Now fill the Links with your er..links, as many as needed. Here's how.
Example:
+OpenLayer+"<a href='http://www.google.com' class='x'>Search with Google</a>"+CloseLayer

If you need to have quots etc in the link text make sure you escape them with a backslash.
Example:
...class='x'> What\'s new </a>"+C...

***************************************************************************************/
Titles[0]="Menu 1";
Titles[1]="Menu 2";
Titles[2]="Menu 3";
Titles[3]="Menu 4";

Links[0]=vs
+OpenLayer+"<a href='http://yahoo.com')' class='x'>Yahoo</a>"+CloseLayer
+OpenLayer+"<a href='http://google.com')' class='x'>Google</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer

Links[1]=vs
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer

Links[2]=vs
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer

Links[3]=vs
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer
+OpenLayer+"<a href='javascript:void(\"\")' class='x'>Your links</a>"+CloseLayer

//!!!Alter anything past this point!!!

w1=(MenuWidth+Separater)*Titles.length;
w2=w/2;
i1=w2-MenuWidth-Separater-w1/2;
i2=w2-MenuWidth-Separater-w1/2;
s1=MenuWidth+Separater;
s2=MenuWidth+Separater;
if (w1 > w2*2){i1=-MenuWidth;i2=-MenuWidth}
vy=(n4)?'show':'visible';
vn=(n4)?'hide':'hidden';

//Don't mess about with N4, just use layers.
if (n4){
for (i=0; i < Titles.length; i++){
document.write("<layer name='lnks"+i+"' top=0 left="+(i2+=s2)+" "
+" width="+MenuWidth+" bgcolor="+HighLight+" visibility=hide"
+" onMouseOver='this.visibility=vy; var cd=this.id.length-1; var ab=this.id.charAt(cd); H(ab)' "
+" onMouseOut='this.visibility=vn; var ef=this.id.length-1; var gh=this.id.charAt(ef); B(gh)'>"
+algn1+"<font face="+MenuFont+" size="+MenuFontSize+">"
+"&nbsp;<br>"+Links[i]+"</font>"+algn2+"</layer>");
document.write("<layer name='ttls"+i+"' top=0 left="+(i1+=s1)+" height=0 "
+"width="+MenuWidth+" bgcolor="+MenuBgColor+" "
+"onMouseOver=\"this.bgColor=HighLight; var e=this.id.length-1; var d=this.id.charAt(e); On(d)\" "
+"onMouseOut=\"this.bgColor=MenuBgColor; var e=this.id.length-1; var d=this.id.charAt(e); Off(d)\">"
+algn1+"<font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"
+Titles[i]+"</font>"+algn2+"</layer>");
}
function On(x){for (i=0; i < Titles.length; i++)document.layers['lnks'+x].visibility=vy}
function Off(x){for (i=0; i < Titles.length; i++)document.layers['lnks'+x].visibility=vn}
function B(y){for (i=0; i < Titles.length; i++)document.layers['ttls'+y].bgColor=MenuBgColor}
function H(y){for (i=0; i < Titles.length; i++)document.layers['ttls'+y].bgColor=HighLight}
}
if (!n4){
for (i=0; i < Titles.length; i++){
document.write("<div id='lnks"+i+"' style='position:absolute;"
+"top:0px;left:"+(i2+=s2)+"px;width:"+MenuWidth+"px;"
+"background:"+HighLight+";visibility:hidden'"
+" onMouseOver='this.style.visibility=vy; document.getElementById(\"ttls"+i+"\").style.background=HighLight';"
+" onMouseOut='this.style.visibility=vn; document.getElementById(\"ttls"+i+"\").style.background=MenuBgColor'>"
+algn1+Links[i]+algn2+"</div>");
document.write("<div id='ttls"+i+"' style='position:absolute;top:0px;left:"+(i1+=s1)+"px;height:auto;width:"+MenuWidth+"px;"
+"background:"+MenuBgColor+";cursor:default'"
+" onMouseOver='document.getElementById(\"lnks"+i+"\").style.visibility=vy;this.style.background=HighLight'"
+" onMouseOut='document.getElementById(\"lnks"+i+"\").style.visibility=vn;this.style.background=MenuBgColor'>"
+algn1+"<font face="+MenuFont+" size="+MenuFontSize+" color="+MenuFontColor+">"+Titles[i]+"</font>"+algn2+"</div>");
}
}
function Scroll(){
sy=(ie)?document.body.scrollTop:window.pageYOffset;
for (i=0; i < Titles.length; i++){
if (n4){
document.layers['ttls'+i].top=Separater+sy;
document.layers['lnks'+i].top=Separater+sy;
}
else{
document.getElementById("ttls"+i).style.top=Separater+sy;
document.getElementById("lnks"+i).style.top=Separater+sy;
}
}
setTimeout('Scroll()',150)
}
Scroll();
window.onresize=new Function("window.location.reload()");

if (!n4){
for (i=0; i < document.links.length; i++){
if (document.links[i].href == this.window.location.href)
{
document.links[i].style.color=MenuBgColor;
document.links[i].style.cursor='crosshair';
//document.links[i].innerHTML+=' -';
//alert(i+' '+document.links[i].href);
break;
}
}
}
//-->
</script>
kod przeklej sobie do notatnika i zapisz jako plik htm albo html.

W opisie masz napisane co i jak pozmieniać. myśle, że jako ktoś nie zna angola to i tak się połapie.
--
Pozdro=].

[#17]
16.10.2004 18:36

Retro skad to skopiowałes? ;) Fajne. Zachowam sobie w moim zbiorze web-rozwiazan :)

No to panie Roger, menu juz masz.
Wklej ten skrypt (od Retro) do pliku np. "menu.php". Nastepnie utworz plik "index.php". I teraz zrobimy troche inaczej.

W skrypcie od Retro sa linki w stylu takim :

href='javascript:void(\"\")'

- zmieniasz je tak :

href='index.php?show=1'

"1" oznacza nazwe jakiegokolwiek dokumentu ktory pojawia sie pod menu po kliknieciu na link.
Plik ten jest w katalogu "./strony/data" i ma rozszerzenie ".php". Wszystkie twoje dokumenty wyswietlanie na stronie tam sie beda znajdowac. Mozesz nazwac plik jak chcesz np. "lol.php" a w linku dajesz analogicznie:

href='index.php?show=lol'

Do pliku "index.php" wrzucasz to :

<html>
<body>
<table border=1 cellpadding=0 cellspacing=0 width=100%>
<tr><td>
<?php include("./menu.php"); ?>
</td></tr>
<tr><td>
<?php

global $show;

$file="./strony/data/$show.php";

if(($show)&&(file_exists($file))) {

include("./strony/data/$show.php");

} else { echo("Wybierz link."); }

?>
</td></tr>
</table>
</body>
</html>

Ta tabelka w index.php to tylko prowizorka zeby ci pokazac jak dziala strona. Zmodyfikuj pod swoj layout.

Mam nadziej ze pomoglem :) Latwiej juz nie mogłem :)

[#18]
16.10.2004 18:38

Aha zamiast

} else { echo("Wybierz link."); }

mozna dac

} else { include("./strony/data/news.php"); }

i wyswietla sie np. newsy ;]

[#19]
17.10.2004 23:18

Lukas odezwij sie do mnie na GG jak mozesz. PLZ. 430931

Zaloguj się, żeby odpowiedzieć.