Home > Web Front-end > JS Tutorial > javascript:The difference and application of history.go() and History.back()_javascript skills

javascript:The difference and application of history.go() and History.back()_javascript skills

WBOY
Release: 2016-05-16 17:47:53
Original
1546 people have browsed it
Copy code The code is as follows:





Back refresh

In the C# Web program, if you write the code to return to the previous page for the page button
Copy the code The code is as follows:

this.RegisterClientScriptBlock("E", "");

Where, history.go(-2) should be written as -2. Because the page has been refreshed before the button event is triggered, it should be -2.
Copy code The code is as follows:

Response.Write("");

Also write "-2" here. It is different from writing scripts directly. history.back() is the previous page
Copy code The code is as follows:

i= 1
history.go(i)
[html]
Go to a specified page
If it is history.go(0), it is to refresh these two JS codes, which is equivalent to the advancement of IE , Back function.
The specific use depends on when you need it. For example, the verification during user registration is background verification. This can be used when the requirements are not met, which can minimize the need for users to repeatedly enter data.
For example: loading page:
[code]
function onLoadPage(){
if(event.srcElement.tagName=="SPAN"){
oFrame=top.window.middle .frames[2];
oTxt=event.srcElement.innerText;
switch(oTxt){
case "forward":
oFrame.history.go(1);
case " Back":
oFrame.history.back();
case "Refresh":
oFrame.location.reload();
}
}
}

When opening a jsp page, it must be refreshed with a client script.
Several ways to refresh the page using Javascript:
Copy code The code is as follows:

1 history.go(0)
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window. navigate(location)
7 location.replace(location)
8 document.URL=location.href
Related labels:
js
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template