简体   繁体   English

JavaScript重定向然后显示一条消息

[英]Javascript redirect then show a message

I'm using a basic timed redirect to logout function and would like it to display a message in the location of my choosing after the redirect has completed, IE on a different page to where the redirect was called. 我正在使用基本的定时重定向到注销功能,希望它在重定向完成后将IE显示在我选择的位置中,即IE在与调用重定向不同的页面上。

   <script type="text/javascript">   
   function Redirect() 
   {  
   window.location="../../../../Applications/logout.asp"; 
   } 
   setTimeout('Redirect()', 5000);   
   </script>

I know I can use the basic alert or write, but I'd specifically like the message to be shown in a div of my choice on the target page, is that even possible? 我知道我可以使用基本警报或编写警报,但是我特别希望该消息显示在目标页面上我选择的div中,这是否可能?

You can pass a parameter to the page you are redirecting, kind of like 您可以将参数传递给您要重定向的页面,就像

window.location="../../../../Applications/logout.asp?sessionTimeOut=true";

and then check this parameter on the other page. 然后在另一页上检查此参数。 If it is TRUE you can put a specific message on whenever you want. 如果为TRUE,则可以在需要时随时显示特定消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM