使每个链接的title显示为自己url

时间:2022-11-05 06:20:57

1. -----------------------------------------------------------------------------

<html>
<script language="javascript" type="text/javascript">
window.onload=function()
{
    var links=document.links;
    var length=links.length;
    for(i=0;i<length;i++)
    {
        links[i].title=links[i].href;
    }
}
</script>
<body>
<a href="http://www.163.com">网易</a>
<a href="http://www.baidu.com">百度</a>
</body>
</html>

2. ---------------------------------------------------------------------------------

<a id="a" href="http://www.sina.com" onmouseover="this.title=this.href">sina</a>