这种商品分类导航是怎么做的能不能给点思路?
[url=http://eshopping.ganso.com.cn/Product/Prodetail.aspx?bc=96&prodid=746&moduleid=1]http://eshopping.ganso.com.cn/Product/Prodetail.aspx?bc=96&prodid=746&moduleid=1[/url]研究了好几天
也知道难点在哪
本来这种效果就是用JS代码做的
难点就在于不管是左边还是右边 的显示的那些字和连接都不是固定的,随着后台和数据库的修改而让文字变化
个有牛人给我点思路
做出来我共享... <div id="cat-div" style="padding:5px 10px;">
<ul>
<!--{foreach from=$categories item=cat}-->
<li> <span class="parent-cat"><A href="{$cat.url}">{$cat.name|escape:html}</A></span><br />
<!--{foreach from=$cat.children item=child}-->
<span style="white-space:nowrap;"><A href="{$child.url}">{$child.name|escape:html}</A></span>
<!--{/foreach}-->
</li>
<!--{/foreach}-->
</ul>
</div>
这段就是分类导航的代码 {$cat.name|escape:html}就是大分类{$child.name|escape:html}是这个大分类下边的小分类 你说的这些代码是category_tree.lbi
这文件里的吧
JS代码是在这文件里添加是吗? 我知道
<script language="javascript">
// JavaScript Document
startList = function() {
if (document.all && document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>
这是JS的那功能大代码应该怎么在category_tree.lbi里添加呢? 直接放到第2行或最后就行了! 顶..:lol :P :P 不错! 到底该怎么改呢?? <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="javascript">
// JavaScript Document
startList = function() {
if (document.all && document.getElementById) {
navRoot = document.getElementById("cat-div");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>
<body>
<ul id="cat-div">
<li><a href="{$cat.url}">{$cat.name|escape:html}</a></li>
<ul>
<li><a href="{$child.url}">{$child.name|escape:html}</a></li>
</ul>
</li>
</ul>
</body>
我这么改了下想用这个JS效果 怎么只显示最后一个商品分类的了别的都没了怎么解决??? :lol :lol :lol :lol :lol :lol
页:
[1]
