myfaces 中 Horizontal Panel Navigation 不能使用的解决办法

java 代码

最近想用myfaces网站上的Horizontal Panel Navigation ,结果copy它的例子都不能使用。google一番,发现如下解决方案。

来源:http://www.nabble.com/Horizontal-Panel-Navigation---panelNavigation2-tf2035583.html#a5600977

能够运行的代码如下

 

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>


<html>

<head>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link rel="shortcut icon" href="http://www.gluonvision.com/images/myfaces.ico">

<script type="text/javascript">

<!--


startList = function()

{

if (document.all && document.getElementById)

{

// *************************************************************************

// RM-comment: HERE IS THE CHANGE TO "hNav_outer" from

// http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/resources/org/apache/myfaces/custom/navmenu/htmlnavmenu/resource/HMenuIEHover.js?revision=427657&view=markup

// *************************************************************************

navDivRoot = document.getElementById("myhNav_outer");

navRoot = navDivRoot.childNodes[0];

for (i=0; i<navRoot.childNodes.length; i++)

{

node = navRoot.childNodes[i];

if (node.nodeName=="LI")

{

node.οnmοuseοver=function()

{

this.className+=" over";

}

node.οnmοuseοut=function()

{

this.className=this.className.replace(" over", "");

}

}

}

}

}

window.οnlοad=startList;

// -->

</script>


<style type="text/css">


body { font-family : arial, verdana, Geneva, Arial, Helvetica, sans-serif; font-size : 14px; }


/*

RM-comment: this is the section from the original css/basic.css file, but:

"hNav_outer got replaced by "myhNav_outer", "on" by "on2", and "off" by "off2".



--------------------------------------------------------------

Horizontal Panelnavigation

--------------------------------------------------------------

*/

#myhNav_outer {

margin: 0;

padding: 0;

height: 60px;

width: 800px;

}

#myhNav_outer ul {

padding: 0;

margin: 0;

}

#myhNav_outer ul li ul {

margin: 0;

padding: 0;

}

#myhNav_outer ul a {

text-decoration: none;

}

#myhNav_outer ul li { /*float the main list items*/

margin: 0;

float: left;

display: block;

padding: 5px;

}

#myhNav_outer ul li ul {

display: none;

}

#myhNav_outer ul li.off2 ul, #myhNav_outer ul li.on2 ul { /*put the subnav below*/

position: absolute;

top: 36px;

*top: 44px;/*reposition for IE*/

background: #224d6f;

left: 13px;

*left: 15px;

width: 740px;

}

#myhNav_outer ul li.on2 ul {

display: block;

background: #f90;

}

#myhNav_outer ul li.on2:hover ul, #myhNav_outer ul li.over ul { /*for ie*/

background: #224d6f;

}

#myhNav_outer ul li a {

color: #224d6f;

font-weight: bold;

display: block;

padding: 5;

}

#myhNav_outer ul li.on2 a {

color: #fff;

background: #f90;

}

#myhNav_outer ul li.on2 ul a, #myhNav_outer ul li.off2 ul a {

float: left; /*ie doesn't inherit the float*/

border: 0;

color: #f90;

width: auto;

}

#myhNav_outer ul li.on2:hover ul a, #myhNav_outer ul li.over ul li a { /*for ie - the specificity is necessary*/

background: #224d6f;

}

#myhNav_outer ul li.off2:hover ul, #myhNav_outer ul li.over ul {

display: block;

z-index: 6000;

}

#myhNav_outer ul li.off2 a:hover, #myhNav_outer ul li:hover a, #myhNav_outer ul li.over a {

background: #29497b;

color: #f90;

}

#myhNav_outer ul li.off2 a:hover, #myhNav_outer ul li.on2 a:hover {

color: #f90;

}

/*subnav formatting*/

#myhNav_outer ul li.off2 ul a {

display: block;

background: #224d6f;

color: #fff;

}

#myhNav_outer ul li.on2 ul a {

display: block;

background: #f90;

color: #fff;

}

</style>


</head>

<body>

<f:view>


<t:div id="myhNav_outer" forceId="true">

<t:panelNavigation2 id="mynav1" layout="list" itemClass="off2" activeItemClass="on2" openItemClass="on2"

renderAll="true">

<t:commandNavigation2>

<t:outputText value="Issues ..."/>

<t:commandNavigation2>

<f:verbatim>&#8250; </f:verbatim>

<t:outputText value="MyFaces Documentation ..."/>

</t:commandNavigation2>

<t:commandNavigation2 externalLink="http://www.drupal.org" target="_blank">

<t:outputText value="what the PHP world can do ..."/>

</t:commandNavigation2>

<t:commandNavigation2>

<f:verbatim>&#8250; </f:verbatim>

<t:outputText value="missing examples ..."/>

</t:commandNavigation2>

</t:commandNavigation2>

</t:panelNavigation2>

</t:div>

</f:view>

</body></html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值