佳品网:怎么把超链接的下划线做成虚线的?

来源:百度文库 编辑:中科新闻网 时间:2024/04/28 06:14:00
最好是说说具体做法~!!谢谢了~~.....

用CSS:
<style type="text/css">
<!--
a:link {
border-bottom:#000000 dashed 1px;
text-decoration:none;
}
a:visited {
border-bottom:#000000 dashed 1px;
text-decoration:none;
}
a:active {
border-bottom:#000000 dashed 1px;
text-decoration:none;
}
a:hover {
border-bottom:#000000 dashed 1px;
text-decoration:none;
}
-->
</style>

<a href="#">看看效果</a>

使用JavaScript写一段document.write单元格的循环程序。首先将程序列出来:

<script>len=400;d1=2;d2=2;cou=Math.floor(len/(d1+d2));
document.write('<table cellspacing=0 cellpadding=0 height=1 width='+len+'><tr>');
for(i=0;i<cou;i++){document.write('<td width='+d2+'><td width='+d1+' bgcolor=333333>')}</script></table>
说明:len=400表示虚线的长度为400像素,d1和d2是黑白相间的间隔,cou=Math.floor(len/(d1+d2)),cou表示总共要循环的次数。例如这里是400像素的虚线,黑色点和白色的点都是2像素,那么就要循环100次。由这200个单元格组成一条虚线。

改变虚线的长度,请修改len=400的值;
改变虚线的颜色,请修改bgcolor=333333的值;
改变虚线的高度,请修改height=1的值;
改变虚线的密度,请修改d1和d2的值。

同意