没有警报,脚本无法正常工作:( [英] Script doesn't work without alerts :(

查看:97
本文介绍了没有警报,脚本无法正常工作:(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



var service = this.WebServiceURL +" / SessionFun?sessionID =" + this.SessionID;


var xmlDoc = document。 implementation.createDocument("","",null);

尝试


{


xmlDoc.async = false;


xmlDoc.load(service);


alert(" now it works");


}


删除上次提醒时,旧版浏览器中的xmlDoc将为空:(我

试图放入暂停那里我写了一个代码,只停止浏览器1,2,

10秒......但是xmlDoc仍然是空的。如果我在0,1之后发出警报
s它有效。如何让它在没有警报的情况下工作?


Jarod

解决方案

> Hey

var service = this.WebServiceURL +" / SessionFun?sessionID =" + this.SessionID
;

var xmlDoc = document.implementation.createDocum ent(",quot;",null);

尝试



xmlDoc.async = false;

xmlDoc.load(service);

alert(现在可以正常工作);

}

删除时最后警告旧浏览器中的xmlDoc将为空:(我试图暂停那里我写了一个代码,只停止浏览器1,
2,10秒...但xmlDoc仍然空。如果我在0,1秒后发出警报,那就可以了。如何让它在没有警报的情况下工作?



我忘了提到它在NN 7.0中不起作用。在更高版本中如

NN 8.0和FF 1,5很棒。

Jarod


>>当您删除上次提醒时,旧浏览器中的xmlDoc将是空的:(我

试图在那里暂停我写了一个代码,只停止浏览器1,
2,
10秒...但是xmlDoc仍然是空的。



你为停止浏览器编写了什么样的代码?
除非你使用了setTimeout(),否则你可能会停止浏览器完成任何事情,包括加载文件。




无所谓我尝试使用一些暂停功能/>
setTimeout没关系。它可能需要10秒而且没有帮助。但

一个0,05s的警报很棒。也许有办法d isplay和关闭

警告代码?

Jarod




Jarod写道:

当你删除最后一个警报时,旧浏览器中的xmlDoc将为空:(我试图在那里暂停我写了一个代码,只停止浏览器1,
2,
10秒......但xmlDoc仍然是空的。



什么你编写了什么代码来阻止浏览器?
除非你使用了setTimeout(),否则你可能会阻止你的浏览器做任何事情,包括加载文件。



我尝试使用一些暂停功能没关系,而我尝试了
setTimeout并不重要。它可能需要10秒甚至没有帮助。但是对于0,05s的一个警报很棒。也许有办法显示和关闭来自代码的警报?




首先,

async = true

*永远永远*


同步请求根本无法在JavaScript中运行而没有真正的b
线程管理机制。更准确地说 - 他们做工作。但它远远超出了你所说的工作的价值。对于一个同步过程。

所以简单地忘记这个标志存在(默认值为true,确切地说

你需要什么)。对于请求状态,有readyState属性,所以你必须在

onreadystatechange上手动模拟* normal *同步。非常感谢脚本引擎制造商(

双方),但它是什么 - 它是。


其次:它是被禁止的规则这个宇宙:-)什么

同步线程" works"在alert()和alert()上。那个

必须是一个组合的错误,其中几个错误被扭曲在一起。更多

代码会有所帮助。


此外它可能与alert()呼叫优先级相关联,因此系统允许它通过

通过甚至将异步从true更改为false。这是*纯粹的

猜测*因为async = true行为的研究相当糟糕(因为没有人使用它b / b)


Hey
var service = this.WebServiceURL +"/SessionFun?sessionID="+ this.SessionID ;

var xmlDoc=document.implementation.createDocument("", "", null);
try

{

xmlDoc.async = false;

xmlDoc.load(service);

alert("now it works");

}

When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1, 2,
10 seconds... but the xmlDoc is still empty. And if I hit an alert after 0,1
s it works. How to make it work without alert ?

Jarod

解决方案

> Hey

var service = this.WebServiceURL +"/SessionFun?sessionID="+ this.SessionID
;

var xmlDoc=document.implementation.createDocument("", "", null);
try

{

xmlDoc.async = false;

xmlDoc.load(service);

alert("now it works");

}

When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1,
2, 10 seconds... but the xmlDoc is still empty. And if I hit an alert
after 0,1 s it works. How to make it work without alert ?


I forgot to mention that it doesn''t work in NN 7.0.In higher versions like
NN 8.0 and FF 1,5 works great.
Jarod


>>When you delete last alert the xmlDoc in older browser will be empty :( I

tried to put a pause there I wrote a code that just stops browser for 1,
2,
10 seconds... but the xmlDoc is still empty.



What sort of code did you write to stop the browser?
Unless you used setTimeout(), you probably stopped your browser from doing
anything at all, including loading the document.



it doesn''t matter I tried to use some pause function with while I tried
setTimeout doesn''t matter. And it can take even 10s and doesn''t help. But
one alert for 0,05s is great. Maybe there is a way to display and close
alert from code ?
Jarod



Jarod wrote:

When you delete last alert the xmlDoc in older browser will be empty :( I
tried to put a pause there I wrote a code that just stops browser for 1,
2,
10 seconds... but the xmlDoc is still empty.



What sort of code did you write to stop the browser?
Unless you used setTimeout(), you probably stopped your browser from doing
anything at all, including loading the document.



it doesn''t matter I tried to use some pause function with while I tried
setTimeout doesn''t matter. And it can take even 10s and doesn''t help. But
one alert for 0,05s is great. Maybe there is a way to display and close
alert from code ?



First of all,
async = true
*always and forever*

Synchronized requests simply do not work in JavaScript without real
thread management mechanics. More correctly - they do "work" but it''s
far away from what you would call "work" for a synchronized process.
So simply forget that this flag exists (default value is true, exactly
what you need). For request status there is readyState property, so you
have to emulate *normal* synchronization manually over
onreadystatechange. Thank you very much to script engine makers (on
both sides), but what is - it is.

Secondly: it is forbidden by the rules of this universe :-) what
synchronized thread "works" upon alert(), and upon alert() only. That
must be a combined bug where several errors are twisted together. More
code would help.

Also it may be connected with alert() call priority so system let it go
through or even changes async from true to false. That''s a *pure
speculation* as async=true behavior is studied rather badly (as no one
uses it).


这篇关于没有警报,脚本无法正常工作:(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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