Сворачивающееся меню! - Форум
Главная | Регистрация | ВходПриветствую Вас Гость | RSS
Реклама на сайте
Всё для Photoshop
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » Всё для Web-мастера » Скрипты для uCoz » Сворачивающееся меню!
Сворачивающееся меню!
FoNYДата: Четверг, 19.03.2009, 14:43 | Сообщение # 1
Начинающий Фотошопер
Группа: Администраторы
Сообщений: 331
Награды: 8
Репутация: 12
Статус: Offline
Вот вам скриптик большого сворачивающегося,древовидного меню...

Code

<HTML>  
<HEAD>  
<title>Virtual Tree</title>  

<script LANGUAGE="JavaScript">  

//each node in the tree is an Array with 4+n positions  
// node[0] is 0/1 when the node is closed/open  
// node[1] is 0/1 when the folder is closed/open  
// node[2] number of children that are documents  
// node[3] is the name of the folder  
// node[4]...node[4+n] are the n children nodes  

// ***************  
// Building the data in the tree  

function generateTree()  
{  
var aux1, aux2, aux3, aux4  

USETEXTLINKS = 0  

foldersTree = gFld("Начало")  

aux1 = insFld(foldersTree, gFld("Локальные документы"))  
insDoc(aux1, gLnk(0, "Кладовая", "/repository/index.html"))  
insDoc(aux1, gLnk(0, "Детская", "/nursery/index.html"))  
aux1 = insFld(foldersTree, gFld("Избранное в Web"))  
aux2 = insFld(aux1, gFld("Узлы друзей"))  
insDoc(aux2,gLnk(1, "Андрей Аликберов", "www.citmgu.ru/~andreya/"))  
insDoc(aux2,gLnk(1, "Андрей Юрченко", "www.ocs.ru/~andin/"))  
insDoc(aux2,gLnk(1, "Сергей Новиков", "novikov.com/"))  
aux2 = insFld(aux1, gFld("Чтение"))  
aux3 = insFld(aux2, gFld("Новости"))  
aux4 = insFld(aux3, gFld("Погода"))  
insDoc(aux4, gLnk(1, "Concord, NH", "cnn.com/WEATHER/html/ConcordNH.html"))  
insDoc(aux3, gLnk(1, "PUBLICO", "www.publico.pt/publico/hoje"))  
insDoc(aux3, gLnk(1, "Diário de Noticias", "www.dn.pt/homepage/home.htm"))  
insDoc(aux3, gLnk(1, "ABCnews", "abcnews.com/"))  
insDoc(aux3, gLnk(1, "CNN", "www.cnn.com/"))  
insDoc(aux3, gLnk(1, "BBC", "news.bbc.co.uk/"))  
insDoc(aux3, gLnk(1, "Computer News Daily", "nytsyn.com/live/Latest/"))  
aux3 = insFld(aux2, gFld("Cartoons"))  
insDoc(aux3, gLnk(1, "The Dilbert Zone", "www.unitedmedia.com/comics/dilbert/"))  
insDoc(aux3, gLnk(1, "Randy Glasbergen", "www.borg.com/~rjgtoons/toon.html"))  
aux3 = insFld(aux2, gFld("Science"))  
insDoc(aux3, gLnk(1, "Discover Magazine", "www.enews.com/magazines/discover/page1a.html"))  
insDoc(aux3, gLnk(1, "Scientific American", "www.sciam.com/"))  
aux3 = insFld(aux2, gFld("Reference"))  
aux4 = insFld(aux3, gFld("Web Authoring"))  
insDoc(aux4, gLnk(1, "Bare Bones Guide to HTML", "werbach.com/barebones/barebone.html"))  
insDoc(aux4, gLnk(1, "JavaScript Guide", "home.netscape.com/eng/mozilla/3.0/handbook/javascript/index.html"))  
insDoc(aux4, gLnk(1, "Excite Help: Getting Listed", "www.excite.com/Info/listing.html"))  
insDoc(aux4, gLnk(1, "Web Site Garage", "www.websitegarage.com/"))  
insDoc(aux4, gLnk(1, "Using META Tags", "www.virtualpromote.com/metatag.html"))  
aux4 = insFld(aux3, gFld("Телефоны"))  
insDoc(aux4, gLnk(1, "118 (Portugal)", "www.telecom.pt/118net"))  
insDoc(aux4, gLnk(1, "BigYellow (USA)", "s8.bigyellow.com/"))  
insDoc(aux3, gLnk(1, "Internet Movie Database", "us.imdb.com/"))  
insDoc(aux3, gLnk(1, "MapQuest! Interactive Atlas Welcome!", "www.mapquest.com/cgi-bin/mqatlas?screen=wm_register&link=wm_main&uid=104adz16d09jizx"))  
insDoc(aux3, gLnk(1, "HomeArts Recipe Finder", "homearts.com/waisform/recipe.htm"))  
insDoc(aux3, gLnk(1, "How Things Work Home Page", "landau1.phys.virginia.edu/Education/Teaching/HowThingsWork/"))  
aux3 = insFld(aux2, gFld("Компьютеры"))  
insDoc(aux3,gLnk(1, "Byte", "www.byte.com/"))  
insDoc(aux3,gLnk(1, "Python", "www.python.org/"))  
insDoc(aux3,gLnk(1, "ZDNet", "www.zdnet.com"))  
insDoc(aux2, gLnk(1, "Newsgroups (using the web)", "www.dejanews.com"))  
insDoc(aux2, gLnk(1, "Motorcyle", "www.motorcycle.com"))  
insDoc(aux2, gLnk(1, "Agenda Cultural de Lisboa", "portugal.hpv.pt/lisboa/agenda/"))  
aux2 = insFld(aux1, gFld("Вперед!"))  
aux3 = insFld(aux2, gFld("Снег"))  
insDoc(aux3,gLnk(1, "Loon Mountain", "www.loonmtn.com/"))  
insDoc(aux3,gLnk(1, "Gunstock", "www.gunstock.com/"))  
insDoc(aux3,gLnk(1, "Wachusett", "www.wachusett.com/"))  
aux2 = insFld(aux1, gFld("Поиск"))  
insDoc(aux2, gLnk(1, "Excite", "www.excite.com"))  
insDoc(aux2, gLnk(1, "Altavista", "altavista.digital.com"))  
insDoc(aux2, gLnk(1, "SAPO (portuguese sites)", "sapo.ua.pt"))  
insDoc(aux2, gLnk(1, "Point's Top 5%", "www.pointcom.com/"))  
insDoc(aux2, gLnk(1, "Top 5% Portugal", "www.ip.pt/top5portugal/main.html"))  
aux2 = insFld(aux1, gFld("Live feed"))  
aux3 = insFld(aux2, gFld("Радио"))  
insDoc(aux3, gLnk(1, "Rádio Comercial On-line", "www.radiocomercial.pt/audio/audio.html"))  
insDoc(aux3, gLnk(1, "TSF- A Rádio em Directo", "www.tsf.pt/"))  
aux2 = insFld(aux1, gFld("Downloads"))  
aux3 = insFld(aux2, gFld("Shareware"))  
insDoc(aux3, gLnk(1, "Windows95.com", "www.windows95.com/apps"))  
insDoc(aux3, gLnk(1, "shareware.com", "www.shareware.com"))  
aux3 = insFld(aux2, gFld("Firmware"))  
insDoc(aux3, gLnk(1, "Iomega zip", "www.iomega.com/product/zip/index.html"))  
insDoc(aux3, gLnk(1, "USRobotics", "www.usrobotics.com/home/20411.02.html"))  
insDoc(aux3, gLnk(1, "Matrox Mystique", "www.matrox.com/mgaweb/3dgaming.htm"))  
insDoc(aux3, gLnk(1, "Radio Track", "www.aimslab.com/"))  
aux2 = insFld(aux1, gFld("Магазины"))  
aux3 = insFld(aux2, gFld("Книги"))  
insDoc(aux3, gLnk(1, "Amazon.com Books", "www.amazon.com/"))  
insDoc(aux3, gLnk(1, "Mistral Books", "www.mistral.ru/"))  
aux3 = insFld(aux2, gFld("Hardware & Software"))  
insDoc(aux3, gLnk(1, "ISN - Internet Shopping Network", "www.internet.net/"))  
insDoc(aux3, gLnk(1, "Computer Express", "www.cexpress.com/"))  
aux3 = insFld(aux2, gFld("Shopping Center"))  
insDoc(aux3, gLnk(1, "IMALL Homepage", "www.imall.com/"))  
insDoc(aux3, gLnk(1, "BizWeb", "www.bizweb.com/"))  
aux3 = insFld(aux2, gFld("Car & services"))  
insDoc(aux3, gLnk(1, "Edmund's Automobile Buyer's Guides", "www.edmunds.com/"))  
insDoc(aux3, gLnk(1, "NY Times guide", "www.nytimes.com/yr/mo/day/auto/autonav.html"))  

clickOnFolderRec(foldersTree, "Начало")  
}  

// Auxiliary function to build the node  
function gFld(name)  
{  
var arrayAux  

arrayAux = new Array  
arrayAux[0] = 0  
arrayAux[1] = 0  
arrayAux[2] = 0  
arrayAux[3] = name  

return arrayAux  
}  

//Append Child of type Folder  
function insFld(parent, child)  
{  
parent[parent.length] = child  
return child  
}  

//Append Child of type Doc  
function insDoc(parent, child)  
{  
parent[2] = parent[2] + 1  
parent[parent.length] = child  
return child  
}  

//these are the last entries in the hierarchy, the local and remote links to html documents (gLnk=generateLinkEntry)  
function gLnk(icon, docDescription, link)  
{  
if (USETEXTLINKS)  
return daveLnk(icon, docDescription, link)  

var retString =""  

if (icon==0)  
{  
retString = "<A href='"+link+"' target=folderFrame><img src='doc.gif' alt='Opens in right frame'"  
}  
else  
{  
if (icon==1)  
retString = "<A href='http://"+link+"' target=_blank><img src='link.gif' alt='Opens in new window'"  
else  
retString = "<A href='http://"+link+"' target=folderFrame><img src='link.gif' alt='Opens in right frame'"  
}  

retString = retString + " border=0></a><td nowrap><font size=-1 face='Arial, Helvetica'>" + docDescription + "</font>"  

return retString  

}  

// This function by davespeed  
function daveLnk(icon, docDescription, link)  
{  
var retString =""  
var l1=""  
var l2="folderFrame"  
var l3="doc"  
var l4="right frame"  

if (icon!=0) {  
l1="http://"  
l2="_blank"  
l3="link"  
l4="new window"  
}  
if (icon==2) {  
l2="folderFrame"  
l4="right frame"  
}  
retString = "<A href='"+l1+link+"' target="+l2+"><img src='"+l3+".gif' alt='Opens in " +l4+ "' border=0></a><td nowrap><A href='"+l1+link+"' target="+l2+"><font size=-1 face='Arial, Helvetica'>" + docDescription + "</font></a>"  

return retString  

}  

// **********************  
// display functions  

//redraws the left frame  
function redrawTree()  
{  
var doc = top.treeFrame.window.document  

doc.clear()  
doc.write("<body bgcolor='white'>\n")  
redrawNode(foldersTree, doc, 0, 1, "")  
doc.close()  
}  

//recursive function over the tree structure called by redrawTree  
function redrawNode(foldersNode, doc, level, lastNode, leftSide)  
{  
var j=0  
var i=0  
var numberOfFolders  
var numberOfDocs  

doc.write("<table border=0 cellspacing=0 cellpadding=0>\n")  
doc.write("<tr>\n<td valign = middle nowrap>\n")  

doc.write(leftSide)  

if (level>0)  
if (lastNode) //the last 'brother' in the children array  
{  
doc.write("<img src='lastnode.gif' width=16 height=22>")  
leftSide = leftSide + "<img src='blank.gif' width=16 height=22>"  
}  
else  
{  
doc.write("<img src='node.gif' width=16 height=22>")  
leftSide = leftSide + "<img src='vertline.gif' width=16 height=22>"  
}  

displayIconAndLabel(foldersNode, doc)  
doc.write("</table>\n\n")  

if (foldersNode.length > 4 && foldersNode[0]) //there are sub-nodes and the folder is open  
{  
numberOfFolders = foldersNode.length - 4 - foldersNode[2]  

// display the folders  
level = level + 1  
for (i=4 ; i < 4 + numberOfFolders; i++)  
{  
if (i == (foldersNode.length - 1))  
redrawNode(foldersNode[i], doc, level, 1, leftSide)  
else  
redrawNode(foldersNode[i], doc, level, 0, leftSide)  
}  
// display the documents  
for ( i = 4 + numberOfFolders; i < foldersNode.length ; i++ )  
{  
doc.write("<table border=0 cellspacing=0 cellpadding=0 valign=middle>")  
doc.write("<tr><td nowrap>")  
doc.write(leftSide)  
if (i == foldersNode.length - 1)  
doc.write("<img src='lastnode.gif' width=16 height=22>")  
else  
doc.write("<img src='node.gif' width=16 height=22>")  
doc.write("</td><td>")  
doc.write(foldersNode[i])  
doc.write("</tr>")  
doc.write("</table>")  
}  
}  
}  

//builds the html code to display a folder and its label  
function displayIconAndLabel(foldersNode, doc)  
{  
doc.write("<A href='javascript:top.openBranch(\"" + foldersNode[3] + "\")'")  
if (foldersNode[1])  
{  
doc.write(" onMouseOver=\'window.status=\"Close folder\"; return true\'><img src=")  
doc.write("openfolder.gif width=24 height=22 border=noborder></a>")  
}  
else  
{  
doc.write("onMouseOver='window.status=\"Open folder\"; return true'><img src=")  
doc.write("closedfolder.gif width=24 height=22 border=noborder></a>")  
}  
doc.write("<td valign=middle align=left nowrap>")  
doc.write("<font size=-1 face='Arial, Helvetica'>"+foldersNode[3]+"</font>")  
}  

//**********************  
// Recursive functions  

//when a parent is closed all children also are  
function closeFolders(foldersNode)  
{  
var i=0  

for (i=4; i< foldersNode.length - foldersNode[2]; i++)  
closeFolders(foldersNode[i])  

foldersNode[0] = 0  
foldersNode[1] = 0  
}  

//recursive over the tree structure  
//called by openbranch  
function clickOnFolderRec(foldersNode, folderName)  
{  
var i=0  

if (foldersNode[3] == folderName)  
{  
if (foldersNode[0])  
closeFolders(foldersNode)  
else  
{  
foldersNode[0] = 1  
foldersNode[1] = 1  
}  
}  
else  
{  
for (i = 4 ; i < foldersNode.length - foldersNode[2]; i++)  
clickOnFolderRec(foldersNode[i], folderName)  
}  
}  

// ********************  
// Event handlers  

//called when the user clicks on a folder  
function openBranch(branchName)  
{  
clickOnFolderRec(foldersTree, branchName)  
if (branchName==foldersTree[3] && foldersTree[0]==0)  
top.folderFrame.location="basefolder.html" //closing the root folder  
//makes the welcome page to show  
timeOutId = setTimeout("redrawTree()",100)  
}  

//called after this html file is loaded  
function initializeTree()  
{  
generateTree()  
redrawTree()  
}  

var foldersTree = 0  
var timeOutId = 0  
var USETEXTLINKS = 0  
generateTree() //sometimes when the user reloads the document Netscape 3.01 does not trigger the onLoad event (!!)  

</script>  

</HEAD>  
<FRAMESET cols="352" onLoad='initializeTree()'>  
<FRAME src="basetree.html" name="treeFrame" scrolling="auto">  

</frameset>  

</HTML>

Скрипт вставляем куда надо,а картинки нужно залить в корень сайта...

Прикрепления: kARTinki.rar (1.0 Kb)



 
Форум » Всё для Web-мастера » Скрипты для uCoz » Сворачивающееся меню!
  • Страница 1 из 1
  • 1
Поиск:

Бесплатный хостинг uCoz