存档

文章标签 ‘html 网页 技巧’

常见网页技巧

2008年6月22日

1.鼠标移动上去,图片变亮,移开又变成灰色。改变的是透明度。

<style>
.p1{filter:Alpha(Opacity=20)}
.p2{filter:Alpha(Opacity=100)}
</style>

<a href=http://www.pealand.com/ target=_blank><img src=images/game01.gif border=0 class=p1 onmouseover=”this.className=’p2′” onmouseout=”this.className=’p1′”></a>
<a href=http://www.pealand.com/sc target=_blank><img src=images/game04.gif border=0 class=p1 onmouseover=”this.className=’p2′” onmouseout=”this.className=’p1′”></a>
<a href=http://bzb.gbq.cn target=_blank><img src=images/game06.gif border=0 class=p1 onmouseover=”this.className=’p2′” onmouseout=”this.className=’p1′”></a>
<a href=http://www.pealand.com/myroom/edit.htm target=_blank><img src=images/game02.gif border=0 class=p1 onmouseover=”this.className=’p2′” onmouseout=”this.className=’p1′”></a>

2.怎样在网页中播放mp3格式音乐
<html>
<title></title>
<body>
<embed src=”
http://music.jztele.com/mp3/dianying/xyxy.mp3

HTML

JavaScript 获取当前页面的滚动条纵坐标位置

2008年5月23日

要获取当前页面的滚动条纵坐标位置,用:

document.documentElement.scrollTop;

而不是:

document.body.scrollTop;

documentElement 对应的是 html 标签,而 body 对应的是 body 标签。

documentElement 不常用。这容易在开发中犯错,网上很多例子,用的是 document.body.scrollTop ,实际上是取不到正确值的。

HTML, Javascript , , , ,