Jump to content
Sign in to follow this  
class_sick

Coding Nak Wat Menu Bar

Recommended Posts

salam.firstly sori la klo dah ader topik cam nie.klo ader korang bg tau link dia.nnt aku close topik nie.

nak mintak tlg kwn2 skit.aku baru nak blaja2 buat website nie.

nak mintak tlg,korang tau xcoding tuk buat menu bar mcm nie.

biler kiter klik satu menu,pastu dia akan kuar sub menu dia.

contoh kat sini,biler klik ikon tambah(+) kat sblh menu tu,pas2 dia akan kuar sub menunyer.

try gie kat http://www.articlesbase.com

aku nak cari kat tenet pun xtau per org panggil tuk coding mcm nie.

aku dah try copy coding dr website tu,tp biler try xjd lak.mayb ader yg tertinggal.

thanks kpd yg sudi membantu.

menubarqh5.th.jpg

Edited by class_sick

Share this post


Link to post
Share on other sites

thanks unexistance,balik nie aku try.aku cuma kompius psl nama coding mcm nie org panggil per.klo dah tau,senang nak cari akt google.nnt aku try.apa2 aku msj kat sini nnt.

Share this post


Link to post
Share on other sites

hehehe...tu la psl...tp kan,bila aku guna firefox,ok jer.tp bile aku view guna IE,kat menu tu kuar la plak TRIAL VERSION...adeihhh...ada sapa2 leh tulun?huhuhu

Share this post


Link to post
Share on other sites

salam.firstly sori la klo dah ader topik cam nie.klo ader korang bg tau link dia.nnt aku close topik nie.

nak mintak tlg kwn2 skit.aku baru nak blaja2 buat website nie.

nak mintak tlg,korang tau xcoding tuk buat menu bar mcm nie.

biler kiter klik satu menu,pastu dia akan kuar sub menu dia.

contoh kat sini,biler klik ikon tambah(+) kat sblh menu tu,pas2 dia akan kuar sub menunyer.

try gie kat http://www.articlesbase.com

aku nak cari kat tenet pun xtau per org panggil tuk coding mcm nie.

aku dah try copy coding dr website tu,tp biler try xjd lak.mayb ader yg tertinggal.

thanks kpd yg sudi membantu.

menubarqh5.th.jpg

cuba try yg ni....ada dua file...run kan file menu1.php

menu.php

<?php

class menu {
var $name;
var $items;
var $open;
var $closed;
var $indent;

function menu($name,
$open = '(-)',
$closed = '(+)',
$indent = ' '
)
{
$this->items = array();
$this->name = $name;
$this->open = $open;
$this->closed = $closed;
$this->indent = $indent;
}

function add($name, $href = "", $target = "") {
$n = count($this->items);

if (is_object($name)) {
$this->items[$n] = $name;
} else {
$this->items[$n]['name'] = $name;
$this->items[$n]['href'] = $href;
$this->items[$n]['target'] = $target;
}
}

function show($nest = 0) {
$urlname = strtr($this->name, ' ', '_');
$indent = '';
global $$urlname;
global $PHP_SELF;
global $QUERY_STRING;

if ($nest) {
$indent = str_repeat($this->indent, $nest);
}

if (isset($$urlname)) {
printf('%s<a href="%s?%s">%s</a><br>',
$indent . $this->open,
$PHP_SELF,
ereg_replace("{$urlname}=&", '', $QUERY_STRING),
$this->name);
echo "n";

while (list(,$item) = each($this->items)) {
if (is_object($item)) {
$item->show($nest + 1);
} else {
printf('%s<a href="%s"%s>%s</a><br>',
$indent . $this->indent,
$item['href'],
(!empty($item['target']) ? ' target="' .
$item['target'] . '"'
: ''),
$item['name']);
echo "n";
}
}
} else {
printf('%s<a href="%s?%s=&%s">%s</a><br>',
$indent . $this->closed,
$PHP_SELF,
$urlname, $QUERY_STRING,
$this->name);
echo "n";
}
}
}

?>
[/codebox]

menu1.php

[codebox]Example
<?php
include('menu.php');

$submenu = new menu('Sub Menu');
$submenu->add('Sub Item 1', 'http://www.yahoo.com', '_new');
$submenu->add('Sub Item 2', 'link.html');

$main = new menu('Main');
$main->add('Main Item 1', 'link.html');
$main->add('Main Item 2', 'link.html');
$main->add($submenu);
$main->add('Main Item 3', 'link.html');

$second = new menu('Secondary Menu');
$second->add('Secondary Item 1', 'link.html');
$second->add('Secondary Item 2', 'link.html');

$main->show();
$second->show();

?>

cuba cari kat sini....

http://www.js-examples.com/

Edited by zal

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...