if导航系统2.0源码(导航ifs)
本文目录一览:
求最短路径的动态规划实现源代码,用C语言在tc2.0中能运行。
希望下面的能对你有所帮助.
我只给出向前处理的代码,
向后处理的你自己改吧,
不然就变成我帮你做作业了.
你可以从递归式"tmp
=
w+GetBestpathF(g,
i,
s,
n,
path);"中看出递推式.
函数名:
GetBestpathF()
参数说明:
g
-Graph
,多段图对象
t
-int,源点
s
-int,汇点
n
-int,总结点个数
path
-Vertex
*,
记录中间路径
函数说明:
后向处理.
函数返回多段图最短路径,
并记录出最短路径的中间结点.
float
GetBestpathF(Graph
g,
int
t,
int
s,
int
n,
Vertex
*path)
{
float
tmp
=
MaxValue;
float
cost
=
MaxValue;
if
(t==s)
return
0;
else{
for
(int
i=0;
ig.NumOfVertices();
i++){
float
w
=
g.GetWeight(t,
i);
if
(w!=0
w!=MaxValue){
//t点到i点的路径存在
tmp
=
w+GetBestpathF(g,
i,
s,
n,
path);
//t的下一个点i到汇点s的最优路径值
if
(tmpcost){
cost
=
tmp;
AddtoPath(t,
i,
path);
}
}
}
}
return
cost;
}
sony网站导航的源码怎么做啊?
FLASH的效果。
用Javascript也可以实现。
我这里有个HTML的。没有用JS
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head
meta http-equiv="Content-Type" content="text/html; charset=GB2312" /
title无标题文档/title
style
body { background:#fff;}
*{ margin:0; padding:0; font-size:12px;}
dl { position:relative; margin:200px auto; border:1px #ccc solid; background:url("") no-repeat 0px -1px;}
dl,dd { width:258px; height:174px;}
dd { overflow:hidden;}
dt { position:absolute; top:1px; left:1px;}
dt a { display:block; width:85px; height:31px; text-align:center; line-height:31px; color:#fff; text-decoration:none; font-weight:bold; float:left;}
dt a:hover {background:url("") no-repeat 1px 1px;}
ul{ width:260px; height:170px; padding:31px 0 0; background:url("") no-repeat 1px 1px;}
li{width:160px;height:24px; line-height:24px; font:12px/27px "宋体",sans-serif;white-space:nowrap;overflow:hidden; margin:0 0 0 4px; list-style:none; border-bottom:1px #ccc dotted; text-indent:20px; background:url("") no-repeat 2px center;}
li a{ font-size:14px; text-decoration:none; color:#f60;}
li a:hover { color:#09f;}
#b{ background-position:86px 1px;}
#c{ background-position:98% 1px;}
/style
/head
body
dl
dta href="#a" title="游戏新闻"游戏/aa href="#b" title="体育新闻"体育/aa href="#c" title="娱乐新闻"娱乐/a/dt
dd
ul id="a"
lia href="#" title="游戏新闻"游戏新闻/a/li
lia href="#" title="游戏新闻"游戏新闻/a/li
lia href="#" title="游戏新闻"游戏新闻/a/li
lia href="#" title="游戏新闻"游戏新闻/a/li
lia href="#" title="游戏新闻"游戏新闻/a/li
lia href="#" title="游戏新闻"游戏新闻/a/li
lia href="#" title="游戏新闻"游戏新闻/a/li
/ul
ul id="b"
lia href="#" title="体育新闻"体育新闻/a/li
lia href="#" title="体育新闻"体育新闻/a/li
lia href="#" title="体育新闻"体育新闻/a/li
lia href="#" title="体育新闻"体育新闻/a/li
lia href="#" title="体育新闻"体育新闻/a/li
lia href="#" title="体育新闻"体育新闻/a/li
lia href="#" title="体育新闻"体育新闻/a/li
/ul
ul id="c"
lia href="#" title="娱乐新闻"娱乐新闻/a/li
lia href="#" title="娱乐新闻"娱乐新闻/a/li
lia href="#" title="娱乐新闻"娱乐新闻/a/li
lia href="#" title="娱乐新闻"娱乐新闻/a/li
lia href="#" title="娱乐新闻"娱乐新闻/a/li
lia href="#" title="娱乐新闻"娱乐新闻/a/li
lia href="#" title="娱乐新闻"娱乐新闻/a/li
/ul
/dd
/dl
/body
/html
JS+CSS
style type="text/css"
#test1 { width: 300px; }
/* 头部总体 css */
.ntab2-head {
clear:both; height: 21px;
border-bottom: #c2130e 3px solid;
text-align: center;
}
/* 头部标头的 css */
.ntab2-head p {
float:left; font-size: 14px; font-weight: bold;
width: 80px; height: 21px;
}
/* 头部列表的 css */
.ntab2-head li {
float:left; background: #dcdcdc; border-left: #f2f2f2 1px solid;
width: 42px; cursor: pointer; font-size: 14px;
line-height: 21px; list-style-type: none;
}
.ntab2-head li.current {
background: #c2130e; color: #ffffff; cursor: none;
}
/* 主体内容的 css? */
.ntab2-body {
text-align: left;
}
.ntab2-body dl {
text-indent: 0px; margin: 0px; padding: 0px;
}
/style
script language="javascript"
function ntab2_register(id, def)
{
var obj = document.getElementById(id);
if (!obj || !obj.hasChildNodes())
{
alert('ERROR: the object was not defined for #' + id + '#');
return;
}
// get head body object
var head = null;
var body = null;
for (var i = 0; i obj.childNodes.length; i++)
{
var node = obj.childNodes[i];
if (node.tagName == 'DIV')
{
if (node.className == 'ntab2-head')
head = node;
else if (node.className == 'ntab2-body')
body = node;
}
}
if (!head) { alert('ERROR: head elements was not found for #' + id + '#'); return; }
if (!body) { alert('ERROR: body elements was not found for #' + id + '#'); return; }
// set action default
var items = head.getElementsByTagName('LI');
var datas = body.getElementsByTagName('DL');
if (items.length == 0) { alert('ERROR: empty set for head elements on #' + id + '#'); return; }
if (items.length != datas.length)
{
alert('ERROR: not equal between body.length and head.length for #' + id + '#');
return;
}
var total = items.length;
if (typeof def == 'undefined') def = 0;
else def = parseInt(def)%total;
if (def 0) def += total;
for (var i = 0; i total; i++)
{
datas[i].style.display = (i == def ? '' : 'none');
items[i].className = (i == def ? 'current' : '');
items[i].onmouseover = function() {
for (var k = 0; k total; k++)
{
datas[k].style.display = (this == items[k] ? '' : 'none');
items[k].className = (this == items[k] ? 'current' : '');
}
}
}
}
/script
div id="test1"
!-- 头部设定 --
div class="59e0-6727-1769-bf90 ntab2-head"
p新闻排行p/p
li国内/li
li国际/li
li社会/li
/div
!-- 内容设定 --
div class="6727-1769-bf90-f258 ntab2-body"
dl
国内-内容
/dl
dl
国际-内容
/dl
dl
社会-内容
/dl
/div
/div
script language="javascript"ntab2_register('test1', 3);/script
帮忙看下这个flash导航源码哪里出了错
他自己没写点之后的效果
// XML Menu Demo
// Coded by Darkvn 2003-0-03
// Mail: Darkvn@blueidea.com
// CopyRight(C) Blueidea.com
System.useCodePage=true; // Unicode Surpport
var ItemCurOpen=null;
var MainItemBGColor=0xe0e0e0;
var MainItemWidth=200;
var MainItemHeight=20;
var MainItemSpace=2;
var MainItemTextColor=0x333333;
var SubItemIndent=20;
var SubItemWidth=180;
var SubItemHeight=18;
var SubItemSpace=1;
var SubItemBGColor=0xf0f0f0;
var SubItemTextColor=0x333333;
var HintWidth=250;
var HintHeight=20;
var HintTextColor=0x666666;
var XMLData=new XML();
XMLData.ignoreWhite=true;
XMLData.onLoad=XMLLoad;
XMLData.load("menu.xml");
function XMLLoad(success){
if(success){
menuNode=this.firstChild;
createEmptyMovieClip("menu",10);
menu._x=20;
menu._y=30;
showMenuNode(menu,menuNode);
}
}
function showMenuNode(mc,node){
for(var i=0;inode.childNodes.length;i++){
mc.createEmptyMovieClip("item"+i,i);
var theItem=mc["item"+i];
theItem.index=i;
theItem.node=node.childNodes[i];
theItem.createEmptyMovieClip("citem",1);
DrawItem(theItem.citem,node.childNodes[i].attributes.label);
theItem.citem.onRollOver=function(){
this.bg.over=true;
this.bg.out=false;
if(!this.open this._parent.node.attributes.hint!=null){
this._parent.createEmptyMovieClip("hint",2);
var theHint=this._parent.hint;
theHint._y=this._parent._height;
DrawHint(theHint,this._parent.node.attributes.hint);
}
}
theItem.citem.onRollOut=function(){
this.bg.over=false;
this.bg.out=true;
if(!this.open){
this._parent.hint.removeMovieClip();
}
}
theItem.citem.onReleaseOutSide=function(){
this.bg.over=false;
this.bg.out=true;
if(!this.open){
this._parent.hint.removeMovieClip();
}
}
theItem.citem.onRelease=function(){
if(!this.open this._parent.node.hasChildNodes){
this._parent.createEmptyMovieClip("subItem",3);
this._parent.subItem._y=this._parent._height;
this._parent.subItem._x=SubItemIndent;
showSubMenu(this._parent.subItem,this._parent.Node);
this.open=true;
doClose(ItemCurOpen);
ItemCurOpen=this._parent;
}else{
if(this.open){
this._parent.subItem.removeMovieClip();
this.open=false;
ItemCurOpen=null;
}
}
}
if(i0){
theItem.onEnterFrame=function(){
var theUpper=this._parent["item"+(this.index-1)];
var dx=theUpper._y+theUpper._height+MainItemSpace-this._y;
if(Math.abs(dx)1) this._y+=dx/3;
}
}
}
}
function doClose(theItem){
theItem.subItem.removeMovieClip();
theItem.hint.removeMovieClip();
theItem.citem.open=false;
}
function showSubMenu(mc,node){
for(var i=0;inode.childNodes.length;i++){
mc.createEmptyMovieClip("subitem"+i,i);
var theSub=mc["subitem"+i];
DrawSubItem(theSub,node.childNodes[i].attributes.label);
theSub._y=i*(SubItemHeight+SubItemSpace);
theSub.onRollOver=function(){
this.bg._alpha=50;
}
theSub.onRollOut=function(){
this.bg._alpha=100;
}
theSub.onReleaseOutSide=function(){
this.bg._alpha=100;
}
}
}
function DrawHint(mc,text){
mc.createTextField("hint",1,0,0,HintWidth,HintHeight);
mc.hint.textColor=HintTextColor;
mc.hint.text=text;
mc.hint.selectable=false;
}
function DrawItem(mc,text){
mc.createEmptyMovieClip("bg",1);
with(mc.bg){
beginFill(MainItemBGColor,100);
moveTo(0,0);
lineTo(MainItemWidth,0);
lineTo(MainItemWidth,MainItemHeight);
lineTo(0,MainItemHeight);
lineTo(0,0);
}
mc.bg.onEnterFrame=function(){
if(this.over){
if(this._alpha99.5) this._alpha+=100-(this._alpha)/4;
}
if(this.out){
if(this._alpha30.5) this._alpha+=(30-this._alpha)/4;
}
}
mc.bg._alpha=30;
mc.createTextField("label",2,0,0,MainItemWidth,MainItemHeight);
mc.label.textColor=MainItemTextColor;
mc.label.text=text;
mc.label.selectable=false;
}
function DrawSubItem(mc,text){
mc.createEmptyMovieClip("bg",1);
with(mc.bg){
beginFill(SubItemBGColor,100);
moveTo(0,0);
lineTo(SubItemWidth,0);
lineTo(SubItemWidth,SubItemHeight);
lineTo(0,SubItemHeight);
lineTo(0,0);
}
mc.createTextField("label",2,0,0,SubItemWidth,SubItemHeight);
mc.label.textColor=SubItemTextColor;
mc.label.text=text;
mc.label.selectable=false;
}
stop();
XML文件
?xml version='1.0' encoding='GB2312'?
menu
item label="首页" hint="回到站点首页" url="/"/
item label="业界动态" hint="改版改的我好头大"
item label="本站动态" hint="改版日志-做网站,就得象绣花"/
item label="软件信息" hint="MM Resource Kit Volume 3 推出"/
item label="硬件信息" hint="全球首款 迅驰平台的Tablet PC"/
item label="设计比赛" hint="央视征集“防非典倡文明新风”公益flash"/
item label="专业书讯" hint="《网页新锐全接触》现正畅销热卖"/
item label="招聘求职" hint="[上海]上海好耶广告招设计师二名"/
item label="其它信息" hint="技术站点 Flash8.net 更换 logo"/
/item
item label="技术文档" hint="Windows 桌面风格页面制作点滴"
item label="网页制作" hint="n(n2)幅图片轮换擦洗显示" /
item label="图形图像" hint=" photoshop 鼠标插画大作战" /
item label="多媒体制作"/
item label="网络编程"/
/item
item label="艺术设计" hint="装帧艺术是书籍的美学灵魂"
item label="设计理论" /
item label="pages"/
/item
item label="摄影摄像" hint="照像机的景深概念与计算"
item label="摄影作品"/
item label="摄影游记"/
item label="摄影器材"/
item label="摄影技巧"/
item label="摄影动态"/
item label="摄影好站"/
/item
item label="计算机技术" hint="汉化一个FTPList列表软件"
item label="操作系统"/
item label="网络安全"/
item label="应用程序"/
item label="网络工程"/
/item
item label="资源下载 " /
item label="个人专栏" hint="实时切换big5/gb2312简繁体 "
item label="会员文章 "/
item label="flyingbird"/
item label="quester"/
item label="redsteps"/
item label="爱老虎油"/
item label="痛饮狂歌"/
item label="秋水无恨"/
/item
item label="CG绘画" /
item label="经典论坛" hint="" url="" /
/menu