JS return and refresh, ASP return and refresh

Source: Internet
Author: User
JS return and refresh, ASP return and refresh

I:

JS reload page, local refresh, back to previous page

<A href = "javascript: history. Go (-1)"> return to the previous page </a>
<A href = "javascript: location. Reload ()"> reload the page and refresh it locally </a>
<A href = "javascript: history. Go (-1); location. Reload ()"> return to the reload page of the previous page and refresh the page locally </a>

Return to the first two pages and refresh the JSCodeHow to write.

 

 

II:

JS method: <a href = "#" onclick = "self. Location = Document. referrer;"> return </a>

Methods for ASP to automatically return and refresh:
Response. Write ("<script language = JavaScript> self. Location = Document. referrer; </SCRIPT> ")

It is generally used to submit an action to a page and return to the previous page and refresh it!

 

III:

Use Js in ASP to return to and refresh the previous page

In ASP, JS is used to return to the previous page and refresh the page. I think it is often used to develop websites using ASP. But there are also several writing methods, but the purpose is the same.

<%
Response. Write ("<font color =" red "" font-size = "" 12px ""> deleted successfully! Font> ")

%>

<Div align = "center"> [<a href = "/" onclick = "javascript: window. history. go (-1); Return false; "class =" fontsize14 "> <span style =" color: # cc0033 "> return </span> </a>] </div>

The function of this Code is to inform the user that if the function has been achieved, it is best to refresh the original page to display new information or make the deleted items not displayed. However, this code cannot refresh the original webpage when it returns.

Therefore, you need to add the following code to the original page:

<SCRIPT>
If (window. Name! = "Bencalie "){
// Refresh the page if its name attribute is not the specified name
Location. Reload ();
Window. Name = "bencalie ";
}
Else {
// If the name attribute of the page is the specified name, nothing will be done, avoiding constant refresh.
Window. Name = "";
}
</SCRIPT>

In this way, we can achieve our goal-return to the previous page and refresh it.

Of course there is more simple code than this, response. Write "<SCRIPT> alert ('deleted successfully! '); Window. Location = 'original page'; </SCRIPT>"

 

Reprinted: http://hi.baidu.com/snss324/item/2869fdfeb134d65dc8f3373b

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.