如何检查链接的存在? [英] How to check existsence of a link?

查看:60
本文介绍了如何检查链接的存在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为标题,如何在javascript中进行ckecking?

谢谢!

解决方案



Cylix写道:


作为标题,如何在javascript中进行ckecking?

谢谢!



var links = document.links;

for(var i = 0; i< links.length; i ++)

{

//点击此处查看具体链接

//

//示例:

// if(links [i]!= null)

// {

// alert(链接存在:));

//休息;

//}

}


marss写道2007年2月1日在comp.lang.javascript


>

Cylix写道:


>作为标题,如何在javascript中进行ckecking?
谢谢!



var links = document.links;

for(var i = 0; i< links.length; i ++)

{

//点击此处查看具体链接

//

//示例:

// if(links [i]!= null)

// {

// alert(链接存在:));

//休息;

//}
}



我认为OP想要在线测试网站的存在。

测试你知道应该在那里的图像。


< img src =

''http://iacnn.net/cnn/2007/WORLD/europe/02/01/blair.police/t1.blair.ap.jp

g''

onload =''alert(" cnn found")''

onerror =''alert(" cnn not found")''


>



-

Evertjan。

荷兰。

(请更改在我的电子邮件地址中的点数x)来自


" Evertjan。 < ex ************** @ interxnl.netwrote in message

news:Xn **************** **** @ 194.109.133.242 ...


marss于2007年1月1日在comp.lang.javascript中写道


>>
Cylix写道:


>>作为标题,如何用javascript做ckecking?
谢谢!


var links = document.links;
for(var i = 0; i< links.length; i ++)
//
//点击此处查看具体链接
//
//示例:
// if(links [i]!= null)
// {
// alert( 存在一个链接:)");
// break;
//}
}



我认为OP想要在线测试网站的存在。


测试你知道的图像应该在那里。


< img src =

''http://iacnn.net/cnn/2007/WORLD/europe/02/01/blair.police/t1.blair.ap.jp

g''

onload =''alert(" cnn found")''

onerror =''alert(" cnn not found" ;)''



你以格式化标记的方式杀了我。 (不错!)


哦,顺便说一下,JSWorld不再是一个JavaScript网站了。


-Lost


As the title, How to do the ckecking in javascript?
Thanks!

解决方案


Cylix wrote:

As the title, How to do the ckecking in javascript?
Thanks!

var links = document.links;
for(var i = 0; i < links.length; i++)
{
//check here for specific link
//
//Example:
//if (links[i] != null)
//{
// alert("A link exists :)");
// break;
//}
}


marss wrote on 01 feb 2007 in comp.lang.javascript:

>
Cylix wrote:

>As the title, How to do the ckecking in javascript?
Thanks!


var links = document.links;
for(var i = 0; i < links.length; i++)
{
//check here for specific link
//
//Example:
//if (links[i] != null)
//{
// alert("A link exists :)");
// break;
//}
}

I think that the OP wants to test the existence of a website on line.
Test for an image you know should be there.

<img src=
''http://i.a.cnn.net/cnn/2007/WORLD/europe/02/01/blair.police/t1.blair.ap.jp
g''
onload=''alert("cnn found")''
onerror=''alert("cnn NOT found")''

>

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...

marss wrote on 01 feb 2007 in comp.lang.javascript:

>>
Cylix wrote:

>>As the title, How to do the ckecking in javascript?
Thanks!


var links = document.links;
for(var i = 0; i < links.length; i++)
{
//check here for specific link
//
//Example:
//if (links[i] != null)
//{
// alert("A link exists :)");
// break;
//}
}


I think that the OP wants to test the existence of a website on line.
Test for an image you know should be there.

<img src=
''http://i.a.cnn.net/cnn/2007/WORLD/europe/02/01/blair.police/t1.blair.ap.jp
g''
onload=''alert("cnn found")''
onerror=''alert("cnn NOT found")''

You kill me the way you format your markup. (Not a bad thing!)

Oh and by the way, JSWorld is not a JavaScript site anymore.

-Lost


这篇关于如何检查链接的存在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆