[JS]如何阻止我的页面冻结? [英] [JS] How do I stop my page from freezing?

查看:79
本文介绍了[JS]如何阻止我的页面冻结?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了每个提示,当最后一个提示完成/关闭时,整个页面(在某些情况下浏览器)冻结。我无法重新加载页面。知道为什么会这样吗?



<!DOCTYPE HTML> 
< meta charset = UTF-8>
< html>
< head>
< script type = text / javascript defer>
function delivery(){
var custName1 = prompt( 订单的名称是什么?');
var custAddress1 = prompt(' 什么地址我们应该下订单吗?');
var custNumber1 = prompt(' 请输入您的电话号码(固定电话)以防我们需要与您联系');
while (custNumber1> 8600000 || custNumber1< 9999999 );
{ var custNumber1 = prompt(' 请输入有效的电话号码。(8600000-9999999)');
}
如果(custNumber1< = 8600000 || custNumber1> = 9999999 );
{alert(' 此信息是否正确?\ n客户名称:' + custName1 + < span class =code-string>'
\ nCustomer Address:' + custAddress1 + ' / nCustomer(land-line)number:' + custNum1 + ' ');
}
}
< / script>
< title> Pete ' s Pizza< / title>
< / head>
< body bgcolor =#66FFCC>
< div id =main>< center>< h1> Pete'
s Pizza < / h1 >
< h2> 吉斯伯恩最好的披萨! < / h2 > < br>
< h2> < font color = red>◄ < / font > Pete < span class =code-string>' s Pizza Menu< font color =red>►< / font> < / H2>
< br>
< h3>标准比萨饼(夏威夷,奶酪,素食,至尊,意大利辣香肠) - 费用:< font color =red> $ 9:50 < /字体>< / H3>
< h3>美食比萨饼(肉类爱好者,鸡肉,虾) - 费用:< font color =red> $ 15.50 < /字体>< / H3>
< br>< br>
< hr width =1200pxcolor =#003300>
< br>
< h2> < font color =#003300>◄< / font>这是'代答'<的顺序/ span> 或' Delivery ' ?< font color = #003300 > ►< /字体> < / H2><峰; br>
< input type = button value =Deliveryonclick =delivery()id =delivery> < input type = button value =Pickuponclick =pickup()id =pickup>
< / center>
< / div>
< / body>
< / html>





我试过调试,我找不到任何东西.. 。



我在今天早上发的reddit帖子上开始了这个帖子。但是在reddit中,你不能完全碰到帖子,所以我把它移到这里。 div class =h2_lin>解决方案

9:50 < / font>< / h3>
< h3>美食比萨饼(肉类爱好者,鸡肉,虾) - 费用:< font color =red>


15.50 < /字体>< / H3>
< br>< br>
< hr width =1200pxcolor =#003300>
< br>
< h2> < font color =#003300>◄< / font>这是'代答'<的顺序/ span> 或' Delivery ' ?< font color = #003300 > ►< /字体> < / H2><峰; br>
< input type = button value =Deliveryonclick =delivery()id =delivery> < input type = button value =Pickuponclick =pickup()id =pickup>
< / center>
< / div>
< / body>
< / html>





我试过调试,我找不到任何东西.. 。



我在今天早上发的reddit帖子上开始了这个帖子。但是在reddit中,你不能完全碰到帖子,所以我把它移到这里。 / blockquote>

语法不正确,在while和if语句之后,我把

';'。我认为FireBug会发现错误:o无论如何。


I go through each of the prompts, and when the last one is finished/closed, the whole page (and in some instances 'browser') freezes. I can't reload the page. Any idea why this might be?

<!DOCTYPE HTML>
<meta charset="UTF-8">
<html>
<head>
<script type="text/javascript" defer>
function delivery(){
var custName1 = prompt('What name will the order be under?');
var custAddress1 = prompt ('What address should we deliver the order to?');
var custNumber1 = prompt ('Please enter your phone number (land-line) in case we need to contact you');
while(custNumber1 > 8600000 || custNumber1 < 9999999);
	{var custNumber1 = prompt('Please enter a valid phone number. (8600000-9999999)');
}
if(custNumber1 <= 8600000 || custNumber1 >= 9999999);
	{alert('Is this information correct?\nCustomer Name: '+custName1+'\nCustomer Address: '+custAddress1+'/nCustomer (land-line) number: '+custNum1+'' );
}
}
</script>
<title>Pete's Pizza</title>
</head>
<body bgcolor="#66FFCC">
<div id="main"><center><h1>Pete's Pizza</h1>
<h2>"The best pizza in Gisborne!"</h2><br>
<h2><font color="red">◄</font> Pete's Pizza Menu <font color="red">►</font></h2>
<br>
<h3>Standard Pizzas (Hawaiian, Cheese, Veggie, Supreme, Pepperoni) - cost: <font color="red">$9:50</font></h3>
<h3>Gourmet Pizzas (Meat-lovers, Chicken, Prawn) - Cost: <font color="red">$15.50</font></h3>
<br><br>
<hr width="1200px" color="#003300">
<br>
<h2><font color="#003300">◄ </font>Is this order for 'Pickup' or 'Delivery'?<font color="#003300"> ►</font></h2><br>
<input type=button value="Delivery" onclick="delivery()" id="delivery"> <input type=button value="Pickup" onclick="pickup()" id="pickup">
</center>
</div>
</body>
</html>



I've tried debugging, I couldn't find anything...

I started this thread on a reddit post I made this morning. But in reddit, you can't exactly bump posts, so I moved it here.

解决方案

9:50</font></h3> <h3>Gourmet Pizzas (Meat-lovers, Chicken, Prawn) - Cost: <font color="red">


15.50</font></h3> <br><br> <hr width="1200px" color="#003300"> <br> <h2><font color="#003300">◄ </font>Is this order for 'Pickup' or 'Delivery'?<font color="#003300"> ►</font></h2><br> <input type=button value="Delivery" onclick="delivery()" id="delivery"> <input type=button value="Pickup" onclick="pickup()" id="pickup"> </center> </div> </body> </html>



I've tried debugging, I couldn't find anything...

I started this thread on a reddit post I made this morning. But in reddit, you can't exactly bump posts, so I moved it here.


Incorrect syntax, after the while and if statements, I put
';'. I thought that FireBug would pick up on the errors :o No matter.


这篇关于[JS]如何阻止我的页面冻结?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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