1.
<a href="#" onclick="javascript:openURL('abc')">测试1</a>
<a href="#" onclick="javascript:openURL('def')">测试2</a>
<SCRIPT LANGUAGE="JavaScript">
function openURL(s)
{
alert(event.srcElement.innerText);
}
</SCRIPT>
2.
<a href="javascript:openURL('abc')">测试1</a>
<a href="javascript:openURL('def')">测试2</a>
<div id=x></div>
<script>
function openURL(s)
{
o = parent.document.links
for(i=0;i<o.length;i++)
{
if(o[i].href=="javascript:openURL('" + s + "')")
alert(o[i].innerText)
}
}
</script>
3.
<a href="javascript:void(openURL('abc'))">测试1</a>
<a href="javascript:void(openURL('def'))">测试2</a>
<div id=x></div>
<script>
function openURL(s)
{
o = parent.document.links
for(i=0;i<o.length;i++)
{
if(o[i].href=="javascript:void(openURL('" + s + "'))")
alert(o[i].innerText)
}
}
</script>
4.
<script>
function openURL(pageid) {
o = document.links;
for(i=0;i<o.length;i++) {
if(o[i].href.indexOf(pageid)) {
v = o[i].innerText;
break;
}
}
do sth with var v...
}
</script>
posted on 2006-04-03 15:17
汪杰 阅读(1115)
评论(0) 编辑 收藏 引用 所属分类:
hengxing网站js