Вторник, 16.04.2024, 23:36
ГлавнаяРегистрацияВход
Приветствую Вас Гость | RSS
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » Web-Мастеру » HTML и CSS » Обычное меню с подменю
Обычное меню с подменю
all-softДата: Четверг, 22.05.2008, 22:36 | Сообщение # 1
Admin
Группа: Администраторы
Сообщений: 10048
Репутация: 1
Статус: Offline
Содержимое этой таблицы поместите между <HEAD> и </HEAD>
Code
<!-- from www.pokolenie.ucoz.ru -->
<style>
<!--
#foldheader{cursor:hand ; font-weight:bold ;
list-style-image:url(fold.gif)}
#foldinglist{list-style-image:url(list.gif)}
//-->
</style>
<script language="JavaScript1.2">
<!--

var head="display:''"
img1=new Image()
img1.src="fold.gif"
img2=new Image()
img2.src="open.gif"

function change(){
if(!document.all)
return
if (event.srcElement.id=="foldheader") {
var srcIndex = event.srcElement.sourceIndex
var nested = document.all[srcIndex+1]
if (nested.style.display=="none") {
nested.style.display=''
event.srcElement.style.listStyleImage="url(open.gif)"
}
else {
nested.style.display="none"
event.srcElement.style.listStyleImage="url(fold.gif)"
}
}
}

document.onclick=change

//-->
</script>

Содержимое этой таблицы поместите между <BODY> и </BODY>
Code
<ul>
<li id="foldheader">Link</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.cnn.com">CNN</a></li>
<li><a href= "http://www.abcnews.com">ABC News</a></li>
<li><a href= "http://www.vancouversun.com">Vancouver Sun</a></li>
</ul>

<li id="foldheader">Link1</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href= "http://www.gamespot.com">GameSpot</a></li>
<li><a href= "http://www.happypuppy.com">Happy Puppy</a></li>
<li><a href= "http://www.gamecenter.com">Game Center</a></li>
</ul>

<li id="foldheader">Link2</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href="http://www.download.com">outer 1</a></li>
<li><a href="http://www.hotfiles.com">outer 2</a></li>
<li id="foldheader">JavaScript & DHTML</li>
<ul id="foldinglist" style="display:none" style=&{head};>
<li><a href= "http://www.dynamicdrive.com">Dynamicdrive </a> </li>
<li><a href="http://javashelp.cjb.net">JS Help</a></li>
</ul>
<li><a href="http://www.windows95.com">outer 3</a></li>
<li><a href="http://www.shareware.com">outer 4</a></li>
</ul>
</ul>
<script language="JavaScript1.2">
<!--
/**
* Get cookie routine by Shelley Powers   
* (shelley.powers@ne-dev.com)
*/
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {   
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue= unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

if (get_cookie(window.location.pathname) != ''){
var openresults= get_cookie(window.location.pathname).split(" ")
for (i=0 ; i < openresults.length ; i++){
foldinglist[openresults[i]].style.display=''
document.all[foldinglist[openresults[i]].sourceIndex -
1].style.listStyleImage="url(open.gif)"
}
}

if (document.all){
var nodelength=foldinglist.length-1
var nodes=new Array(nodelength)
var openones=''
}

function check(){
for (i=0 ; i <= nodelength ; i++){
if (foldinglist[i].style.display=='')
openones=openones + " " + i
}
document.cookie=window.location.pathname+"= "+openones
}

if (document.all)
document.body.onunload=check
//-->
</script>
 
Награды:
Форум » Web-Мастеру » HTML и CSS » Обычное меню с подменю
  • Страница 1 из 1
  • 1
Поиск:

Copyright MyCorp © 2024Сделать бесплатный сайт с uCoz