用js设置div层始终在网页底部显示及使用JS获取网页高度和屏幕分辨率高度
作者: admin 日期: 2012-08-17
来源: Duing-冬忆个人博客
实现div始终在网页底部显示,代码如下:
< style>
DIV {
BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 0px
}
< /style>
< div id="t1" style="position:absolute;border:double; width:100%; text-align:center">div层始终在网页底部显示的内容< /div>
< script language="javascript">
//document.all.t1.style.top = document.body.clientHeight;
var h1 = window.screen.availHeight-170;
if (document.body.clientHeight<h1)
document.all.t1.style.top = window.screen.availHeight-170;
//document.write ("当前窗口宽:"+document.body.offsetWidth+"; 高:"+document.body.clientHeight+"aaaa"+(window.screen.availHeight));
< /script>
在线演示
原文链接地址:http://www.duing.cn/article/Study/DIV_DiBuXianShi.html
实现div始终在网页底部显示,代码如下:
< style>
DIV {
BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; BORDER-RIGHT-WIDTH: 0px
}
< /style>
< div id="t1" style="position:absolute;border:double; width:100%; text-align:center">div层始终在网页底部显示的内容< /div>
< script language="javascript">
//document.all.t1.style.top = document.body.clientHeight;
var h1 = window.screen.availHeight-170;
if (document.body.clientHeight<h1)
document.all.t1.style.top = window.screen.availHeight-170;
//document.write ("当前窗口宽:"+document.body.offsetWidth+"; 高:"+document.body.clientHeight+"aaaa"+(window.screen.availHeight));
< /script>
在线演示
原文链接地址:http://www.duing.cn/article/Study/DIV_DiBuXianShi.html
网页设计相关:css样式 设置首字大写(占两行)
作者: admin 日期: 2012-08-09
来源: Duing-冬忆个人博客
< style type="text/css">
div{width:500px; line-height:150%;}
.post-body:first-letter {
PADDING-RIGHT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 2.5em; FLOAT: left; COLOR: #f30; LINE-HEIGHT: 1.1em;
}
< /style>
< div class="post-body">
上网给孩子买积木,看中一款,瞄了下评价,有一条留言这样写道:“积木大小正好,孩子一口一个”,于是,我吓得不敢买了。
< /div>
< style type="text/css">
div{width:500px; line-height:150%;}
.post-body:first-letter {
PADDING-RIGHT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 2.5em; FLOAT: left; COLOR: #f30; LINE-HEIGHT: 1.1em;
}
< /style>
< div class="post-body">
上网给孩子买积木,看中一款,瞄了下评价,有一条留言这样写道:“积木大小正好,孩子一口一个”,于是,我吓得不敢买了。
< /div>
文字标题字数过多时,用Css样式设置后面多出的字用省略号代替
作者: admin 日期: 2012-08-08
来源: Duing-冬忆个人博客
适合网站新闻读取时,一些新闻标题文字过长,可用以下代码:
< DIV STYLE="width: 220px; height: 30px; border: 1px solid #ee55cc;
overflow: hidden; text-overflow:ellipsis; padding:5px">
< NOBR>文字标题字数过多,后面自动显示为省略号!< /NOBR>
< /DIV>
最终效果:

原文链接地址:http://www.duing.cn/article/Study/WenZiShengLueHao.html
适合网站新闻读取时,一些新闻标题文字过长,可用以下代码:
< DIV STYLE="width: 220px; height: 30px; border: 1px solid #ee55cc;
overflow: hidden; text-overflow:ellipsis; padding:5px">
< NOBR>文字标题字数过多,后面自动显示为省略号!< /NOBR>
< /DIV>
最终效果:

原文链接地址:http://www.duing.cn/article/Study/WenZiShengLueHao.html
网页中,点击栏目菜单滚动到相应位置内容
作者: admin 日期: 2012-07-13
在flash中读取swf问号后面的数据参数
作者: admin 日期: 2012-07-03
Css设置float后,IE浏览器下margin双倍间距的问题
作者: admin 日期: 2012-06-30
<转%3c,escape,unescape的使用和在ASP中调用js里的编码函数
作者: admin 日期: 2012-06-24
经过几番周折,终于是写好了
< %set rs=server.createobject("adodb.recordset")
sql="select top 6 * from [News] where BigClassID=5 order by ID desc"
rs.open sql,conn,1,1
if rs.eof then
response.write "No information!"
else
cnewstxt="< table cellspacing='0' cellpadding='0' width='100%' align='center'>< tbody>"
j=0
do while not rs.eof
if j>0 and j >= 6 then
exit do
end if
cnewstxt=cnewstxt&"< tr>< td align=left height=20>< img src='../images/news_icon.jpg' /> < a href='NewsShow"&rs("ID")&".html' title='"&rs("Title")&"'>"&cutstr(rs("Title"),15)&"< /a>< /td>< td align=right>2012-6-16< /td>< /tr>"% >
< %j=j+1
rs.movenext
loop
cnewstxt=cnewstxt&"< /tbody>< /table>"
end if
rs.close
set rs=nothing
% >
< script language="javascript" type="text/javascript" runat="server">
function JSAngelEncode(sStr)
{
return escape(sStr);
}
< /script>
< %
Function aspEncode(sStr)
aspEncode= JSAngelEncode(sStr)
End Function
cnewstxt=aspEncode(cnewstxt)
response.Write cnewstxt
% >
< %set rs=server.createobject("adodb.recordset")
sql="select top 6 * from [News] where BigClassID=5 order by ID desc"
rs.open sql,conn,1,1
if rs.eof then
response.write "No information!"
else
cnewstxt="< table cellspacing='0' cellpadding='0' width='100%' align='center'>< tbody>"
j=0
do while not rs.eof
if j>0 and j >= 6 then
exit do
end if
cnewstxt=cnewstxt&"< tr>< td align=left height=20>< img src='../images/news_icon.jpg' /> < a href='NewsShow"&rs("ID")&".html' title='"&rs("Title")&"'>"&cutstr(rs("Title"),15)&"< /a>< /td>< td align=right>2012-6-16< /td>< /tr>"% >
< %j=j+1
rs.movenext
loop
cnewstxt=cnewstxt&"< /tbody>< /table>"
end if
rs.close
set rs=nothing
% >
< script language="javascript" type="text/javascript" runat="server">
function JSAngelEncode(sStr)
{
return escape(sStr);
}
< /script>
< %
Function aspEncode(sStr)
aspEncode= JSAngelEncode(sStr)
End Function
cnewstxt=aspEncode(cnewstxt)
response.Write cnewstxt
% >
网站制作中CSS设置H1不换行
作者: admin 日期: 2012-06-22
个人博客网站的seo优化
作者: admin 日期: 2012-06-05
FireFox与IE下js和css的区别
作者: admin 日期: 2012-05-20
来源: Duing-冬忆个人博客
在不同浏览器下的CSS处理
一般可以用!important来优先使用css语句(仅firefox支持)
比如:{border-width:0px!important;border-width:1px;}
在firefox下这个元素是没有边框的,在IE下边框宽度是1px DIV等元素的边界问题 比如:设置一个div的CSS::{width:100px;height:100px;border:#000000 1px solid;} IE中:div的宽度(包括边框宽度):100px,div的高度(包括边框宽度):100px; 而firefox:div的宽度(包括边框宽度):102px,div的高度(包括边框宽度):102px;
在不同浏览器下的CSS处理
一般可以用!important来优先使用css语句(仅firefox支持)
比如:{border-width:0px!important;border-width:1px;}
在firefox下这个元素是没有边框的,在IE下边框宽度是1px DIV等元素的边界问题 比如:设置一个div的CSS::{width:100px;height:100px;border:#000000 1px solid;} IE中:div的宽度(包括边框宽度):100px,div的高度(包括边框宽度):100px; 而firefox:div的宽度(包括边框宽度):102px,div的高度(包括边框宽度):102px;