日期:2014-05-16  浏览次数:20442 次

如何对整个页面或整个网站的<a>标记应用title属性?谢谢!!!
如题.

------解决方案--------------------
var objs = document.getElementsByTagName( "A ");
for(var i = 0; i < objs.length; i ++){
objs[i].title = "hint ";
}
------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">

<html>
<head>
<title> MyTitle test </title>
<script>
function MyTitle()
{
var links = document.links;
for (i=0; i <links.length; i++)
links[i].title= "My string... ";
}
</script>
</head>

<body onload= "MyTitle(); ">

<P> <A HREF= "http://download.csdn.net/ "> 最新资源下载 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163688 "> 代码大全2英文版.chm </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163750 "> j2ee13种核心技术 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163930 "> UML with Rational Rose从入门到精通 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163689 "> 学习c++的50条忠告 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163751 "> VISUAL C++MFC编程实例 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163695 "> 搜索引擎原理 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163848 "> JAVA核心技术(代码) </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163817 "> 【教程】100个Java GUI swing的小程序.rar </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163743 "> 40种Javascript中常用的使用小技巧 </A> </P>
<P> <A HREF= "http://download.csdn.net/source/163949 "> java学习笔记 </A> </P>

</body>
</html>

------解决方案--------------------
整个网站的话,把
function MyTitle()
{
var links = document.links;
for (i=0; i <links.length; i++)
links[i].title= "My string... ";
}
写成 .js 文件(比如 mytitle.js),每个页面调用.

<SCRIPT language=JavaScript src= "mytitle.js "> </SCRIPT>



------解决方案--------------------
htc实现