<a href="文本页面" target="right">小菜单</a>
要用这样的方式打开新的页面,关键点在target这个值上面,表示你在哪个frame里打开新页面。
此乃层的隐藏与显示也, 一、点击左边的缩进图片,左边栏收缩 二、实现的思路 1、图片作为按扭,点击图片触发层的显示和收缩,图片代码如下: <A href="javascript:show()"><IMG src="image/fclose.gif" align="absmiddle" border="0"></A>三、源代码 <HTML><HEAD><META http-equiv="Content-Type" content="text/htmlcharset=gb2312"><TITLE>收缩左边栏效果</TITLE><STYLE type="text/css">td{font-size:12pxline-height:22px} .red{color: #FF0000} </STYLE><SCRIPT language="JavaScript">function show(){ if(document.getElementById("left").style.display=='none'){ //判断目前左边栏的状态(显示、隐藏) document.getElementById("left").style.display='block'//显示左边栏 } else{document.getElementById("left").style.display='none'//隐藏左边栏} } </SCRIPT></HEAD><BODY><TABLE width="98%" border="0" cellspacing="0" cellpadding="0" align="center"><TR><TD id="left" width="200">点点右边的收缩按钮,看看我是不是进去了!</TD><TD width="8" style="border-right:1 #cccccc solid"><A href="javascript:show()"><IMG src="image/fclose.jpg" align="absmiddle" border="0"></A></TD><TD valign="top">右侧</TD></TR></TABLE> </BODY></HTML>这个只是一个图标字体,一般要结合js点击或者经过触发事件。
代码:
<head><meta charset='utf-8' />
<title>HTML调试</title>
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script src='js/zui.min.js' type='text/javascript' charset='utf-8'></script>
<link rel='stylesheet' type='text/css' href='css/zui.css' />
<style type="text/css">
body,
div,
ul,
li {
margin: 0
padding: 0
}
body {
font-family: "微软雅黑", Arial, Helvetica, sans-serif
color: #333333
line-height: 25px
font-size: 14px
}
a:link,
a:visited {
text-decoration: none
color: #333333
}
a:hover {
text-decoration: underline
color: #08A5E0
text-decoration: none
}
ul,
ul li {
list-style-type: none
}
.cl {
zoom: 1
}
.navbg {
height: 40px
width: 100%
background: #08A5E0
box-shadow: 1px 1px 7px #999
position: absolute
z-index: 99
left: 0
}
#navul li {
float: left
margin-right: 1px
width: 100px
height: 40px
position: relative
text-align: center
line-height: 40px
}
#navul li.navhome {
text-align: left
padding: 0 0px 0 40px
width: 100px
}
#navul li a:link,
#navul li a:visited {
color: #FFFFFF
}
#navul li ul {
display: none
position: absolute
z-index: 10000
top: 38px
left: -1px
background: #006D96
border: #004E6C 1px solid
border-bottom: none
}
#navul li ul li {
display: block
width: 98px
float: none
margin-right: 0px
height: 28px
position: relative
line-height: 28px
border-bottom: #004E6C 1px solid
font-size: 12px
}
#navul li.navmoon {
background: #006D96
border: #004E6C 1px solid
width: 98px
height: 38px
line-height: 38px
}
#navul li.navmoon a {
color: #FFFFFF
}
#navul li.navhome a:hover {
color: #FCFF00
}
#navul li.navmoon ul {
display: block
}
#navul li.navmoon ul a {
display: block
width: 98px
height: 28px
line-height: 28px
}
#navul li.navmoon ul a:hover {
background: #000000
}
</style>
</head>
<body>
<div class="navbg">
<ul id="navul" class="cl">
<li class="navhome">
<a href="" target="_blank">HOME</a>
</li>
<li>
<a href="" title="Html">Html</a>
<ul>
<li>
<a href="" title="HTML">HTML</a>
</li>
<li>
<a href="" title="HTML5">HTML5</a>
</li>
</ul>
</li>
<li>
<a href="" title="CSS">CSS</a>
<ul>
<li>
<a href="" title="CSS入门">CSS入门</a>
</li>
<li>
<a href="" title="CSS工具">CSS工具</a>
</li>
<li>
<a href="" title="CSS技巧">CSS技巧</a>
</li>
<li>
<a href="" title="CSS实例">CSS实例</a>
</li>
<li>
<a href="" title="CSS3">CSS3</a>
</li>
<li>
<a href="" title="CSS hack">CSS hack</a>
</li>
<li>
<a href="" title="CSS2.0 手册">CSS2.0 手册</a>
</li>
</ul>
</li>
<li>
<a href="" title="网页特效">网页特效</a>
<ul>
<li>
<a href="" title="导航菜单">导航菜单</a>
</li>
<li>
<a href="" title="表单按钮">表单按钮</a>
</li>
<li>
<a href="" title="表格图层">表格图层</a>
</li>
<li>
<a href="" title="图片特效">图片特效</a>
</li>
<li>
<a href="" title="滚动特效">滚动特效</a>
</li>
<li>
<a href="" title="文字特效">文字特效</a>
</li>
<li>
<a href="" title="时间日期">时间日期</a>
</li>
<li>
<a href="" title="窗口特效">窗口特效</a>
</li>
<li>
<a href="" title="鼠标特效">鼠标特效</a>
</li>
</ul>
</li>
<li>
<a href="" title="前端资讯">前端资讯</a>
<ul>
<li>
<a href="" title="用户体验">用户体验</a>
</li>
<li>
<a href="" title="前端观察">前端观察</a>
</li>
<li>
<a href="" title="职业生涯">职业生涯</a>
</li>
</ul>
</li>
<li>
<a href="" title="前端技巧">前端技巧</a>
<ul>
<li>
<a href="" title="布局技巧">布局技巧</a>
</li>
<li>
<a href="" title="网页字体">网页字体</a>
</li>
<li>
<a href="" title="flash">flash</a>
</li>
</ul>
</li>
<li>
<a href="" title="杂七杂八">杂七杂八</a>
<ul>
<li>
<a href="" title="帝国cms">帝国cms</a>
</li>
<li>
<a href="" title="电脑技巧">电脑技巧</a>
</li>
<li>
<a href="" title="随笔杂谈">随笔杂谈</a>
</li>
</ul>
</li>
<li>
<a href="" title="Javascript">Javascript</a>
<ul>
<li>
<a href="" title="Jquery">Jquery</a>
</li>
<li>
<a href="" title="Js学习">Js学习</a>
</li>
<li>
<a href="" title="Js教程">Js教程</a>
</li>
</ul>
</li>
<li>
<a href="" title="网站优化">网站优化</a>
<ul>
<li>
<a href="" title="SEO杂谈">SEO杂谈</a>
</li>
<li>
<a href="" title="站长工具">站长工具</a>
</li>
<li>
<a href="" title="经验分享">经验分享</a>
</li>
</ul>
</li>
<li style="width: 50px">
<a href="" title="更多"><i class="icon icon-align-justify"></i></a>
<ul>
<li>
<a href="" title="SEO杂谈">更多1</a>
</li>
<li>
<a href="" title="更多2">更多2</a>
</li>
<li>
<a href="" title="更多3">更多3</a>
</li>
</ul>
</li>
</ul>
</div>
<script type="text/javascript">
$(window).load(function() {
$(".navbg").capacityFixed()
})
$(function() {
$("#navul > li").not(".navhome").hover(function() {
$(this).addClass("navmoon")
}, function() {
$(this).removeClass("navmoon")
})
var maxwidth = 580
$(".news_text img").each(function() {
if($(this).width() > maxwidth) {
$(this).width(maxwidth)
}
})
})
function $tomato(id) {
return document.getElementById(id)
}
function runCode(obj) {
var winname = window.open('', "_blank", '')
winname.document.open('text/html', 'replace')
winname.document.writeln(obj.value)
winname.document.close()
}
(function($) {
$.fn.capacityFixed = function(options) {
var opts = $.extend({}, $.fn.capacityFixed.deflunt, options)
var FixedFun = function(element) {
var top = opts.top
element.css({
"top": top
})
$(window).scroll(function() {
var scrolls = $(this).scrollTop()
if(scrolls > top) {
if(window.XMLHttpRequest) {
element.css({
position: "fixed",
top: 0
})
} else {
element.css({
top: scrolls
})
}
} else {
element.css({
position: "absolute",
top: top
})
}
})
element.find(".close-ico").click(function(event) {
element.remove()
event.preventDefault()
})
}
return $(this).each(function() {
FixedFun($(this))
})
}
$.fn.capacityFixed.deflunt = {
right: 0,
top: 25
}
})(jQuery)
</script>
</body>
结果:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)