<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function replaceTitle(){
var list1 = document.getElementById('list1');
var str = list1.getAttribute('title');
var strReplace = str.replace(/王珞丹/g, "<a href='#' class='wld' id='wld' onclick='linksWLD();'>王珞丹</a>");
//上一行代码只能加指定的某个姓名为超链接,偶的问题是如何让所有姓王的人都加上超链接,请赐码!
var clickCount = true;
list1.onclick = function(){
if(clickCount){
this.innerHTML += '<br />' + strReplace;
clickCount = false;
}
return false;
}
}
function linksWLD(){
window.open('http://bbs.wangluodan.net/','wangluodan','width=800,height=600');
}
window.onload = replaceTitle;
</script>
</head>
<body>
<p id='list1' title='主演:佟大为,马伊莉,文章,李晓璐,王诗槐,朱雨辰,王珞丹,王辉'>电视剧:《奋斗》</p>
</body>
</html>
/王(.*?)(?=,|$)/g