AJAX window.location.href.indexOf(" http")== - 1) [英] AJAX window.location.href.indexOf("http")==-1)

查看:268
本文介绍了AJAX window.location.href.indexOf(" http")== - 1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。

很抱歉打扰你,但我不能确认这个片段中使用的是


(在很多中找到)关于Ajax的脚本)

函数loadpage(page_request,containerid)

{

if(page_request.readyState == 4&&(page_request) .status == 200 ||

window.location.href.indexOf(" http")== - 1))

{

document.getElementById(containerid).innerHTML = pag e_request.responseText;

}

}

你能告诉我吗?

提前致谢;)

再见。

Hi.
Sorry to disturb you but I can''t
figure out its use in this snippet
(Found in many scripts about Ajax)
function loadpage(page_request, containerid)
{
if (page_request.readyState == 4 && (page_request.status==200 ||
window.location.href.indexOf("http")==-1))
{
document.getElementById(containerid).innerHTML=pag e_request.responseText;
}
}
Can you enlighten me ?
Thanks in advance ;)
Bye.

推荐答案

以防万一在本地运行脚本。

its in case you want to run the script locally.


window.location.href.indexOf(" http")== - 1


之前我还没见过,但如果请求页面的网址不包含字符串http,那么这部分声明将是真的



Shimmyshack可能是的,因为如果你在你的计算机上本地运行HTML页面的HTML页面,那么它就不会有http。在

网址中,它会像C:/..."无论如何。

window.location.href.indexOf("http")==-1

I haven''t seen this before, but this part of the statement will be true
if the url of the requesting page does not contain the string "http".
Shimmyshack is probably right, because if you''re running the script in
an HTML page locally on your computer, then it won''t have "http" in the
URL, it''ll be something like "C:/..." whatever.


kd **** @ gmail.com 在2006年11月20日8:49发表以下内容:
kd****@gmail.com said the following on 11/20/2006 8:49 PM:

window.location.href.indexOf(" http")== - 1


我之前没见过这个,但是如果请求页面的url不包含字符串,那么这部分语句将是真的

; http。

Shimmyshack可能是对的,因为如果你在你的计算机上本地运行HTML页面的HTML页面,那么它就没有了" HTTP"在

网址中,它会像C:/..."随你。
window.location.href.indexOf("http")==-1

I haven''t seen this before, but this part of the statement will be true
if the url of the requesting page does not contain the string "http".
Shimmyshack is probably right, because if you''re running the script in
an HTML page locally on your computer, then it won''t have "http" in the
URL, it''ll be something like "C:/..." whatever.



如果你在本地运行它,readyState永远不会是200.


-

Randy

机会有利于准备好的心灵

comp.lang.javascript常见问题 - http://jibbering.com/faq

Javascript最佳实践 - http://www.JavascriptToolbox.com/bestpractices/


这篇关于AJAX window.location.href.indexOf(" http")== - 1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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