我有一个ExtJS MessageBox,我想在整个页面加载之前显示它,但除非我在Ext.onReady中写它,它不会加载。 我怎么能让它发挥作用。
这是我的代码(我想使用):
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>现在这是有效的:
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.onReady(function() { Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); )}; </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>但是上面的代码在无限循环中发送MessageBox,因此它违背了框的目的,我需要框才会出现,直到我的页面中的Java代码被执行。 因此,如果MessageBox在页面加载后呈现,则没有任何意图。
I have an ExtJS MessageBox that I want to be shown even before the whole page is loaded, but unless I write it within Ext.onReady it doesn't load. How am I supposed to make it work.
This is my Code(which I would like to use):
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>Now this is what works:
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.onReady(function() { Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); )}; </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>But the above code sends the MessageBox in the Infinite loop so it defeats the purpose of the box, I need the box to appear only till the Java code in my page is executed. So if MessageBox renders after the page load then there is no purpose to it.
最满意答案
在浏览器完成加载之前,您无法使用框架的某些部分。 在您的情况下,您的浏览器似乎在框架的所有部分完成加载之前开始执行最后一个脚本块。
但有一种方便的方法来处理这个问题; 您只需将消息的一些标记添加到dom中,然后使用onReady事件将其删除。
You cannot use parts of the framework before the browser finished loading these. In your case your browser seems to start executing the last script block before all parts of the framework finished loading.
But there is a convenient way to handle this; You should simply add some markup for your message to the dom and remove it with the onReady event.
除非我使用Ext.onReady,否则我无法显示ExtJS Message.Box(I am not able to show an ExtJS Message.Box unless I use Ext.onReady)我有一个ExtJS MessageBox,我想在整个页面加载之前显示它,但除非我在Ext.onReady中写它,它不会加载。 我怎么能让它发挥作用。
这是我的代码(我想使用):
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>现在这是有效的:
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.onReady(function() { Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); )}; </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>但是上面的代码在无限循环中发送MessageBox,因此它违背了框的目的,我需要框才会出现,直到我的页面中的Java代码被执行。 因此,如果MessageBox在页面加载后呈现,则没有任何意图。
I have an ExtJS MessageBox that I want to be shown even before the whole page is loaded, but unless I write it within Ext.onReady it doesn't load. How am I supposed to make it work.
This is my Code(which I would like to use):
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>Now this is what works:
<html> <head> <title>Sorry</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width"> <script type="text/javascript" src="ext-all.js"></script> <link rel="stylesheet" type="text/css" href="ext-all.css" /> <script type="text/javascript"> Ext.onReady(function() { Ext.MessageBox.show({ msg: 'Activating your account, please wait....', progressText: 'Authenticating E-Mail address', width: 300, wait: true, waitConfig: {interval: 200} }); )}; </script> </head> <body> </body> </html> <% String UUID = request.getParameter("uuid"); userOperation UA = new userOperation(); UA.activateUser(UUID); %> <script type="text/javascript"> Ext.MessageBox.hide(); Ext.Msg.alert('Welcome', 'Your account has been activated, You can now login'); </script>But the above code sends the MessageBox in the Infinite loop so it defeats the purpose of the box, I need the box to appear only till the Java code in my page is executed. So if MessageBox renders after the page load then there is no purpose to it.
最满意答案
在浏览器完成加载之前,您无法使用框架的某些部分。 在您的情况下,您的浏览器似乎在框架的所有部分完成加载之前开始执行最后一个脚本块。
但有一种方便的方法来处理这个问题; 您只需将消息的一些标记添加到dom中,然后使用onReady事件将其删除。
You cannot use parts of the framework before the browser finished loading these. In your case your browser seems to start executing the last script block before all parts of the framework finished loading.
But there is a convenient way to handle this; You should simply add some markup for your message to the dom and remove it with the onReady event.
发布评论