When you use Asp.net to develop web pages, you will find that if you set a page, if it contains multiple buttons, and the page is very long.
When you click "PostBack" after the button, the page is always displayed at the top, which is extremely inconvenient.
But the code for the following methods helps you solve this problem.
Method 1:
- <Input type = "Submit" name = "button1" value = "button" id = "button1"/>
- <Input type = "hidden" id = "window_offsety" name = "window_offsety" value = "0">
- <Input type = "hidden" id = "window_offsetx" name = "window_offsetx" value = "0">
- <Script language = "JavaScript">
- VaR UA = navigator. useragent. tolowercase ();
- VaR isie = (UA. indexof ('msie ')! =-1 &&! This. isopera & (UA. indexof ('webtv') =-1 ));
- Function window_onsubmitie (){
- Document. getelementbyid ("window_offsety"). value = Window. event. offsety-window. event. clienty + 2;
- Document. getelementbyid ("window_offsetx"). value = Window. event. offsetx-window. event. clientx + 2;
- }
- Function window_onsubmitns (event ){
- Document. getelementbyid ("window_offsety"). value = event. Pagey-event. clienty;
- Document. getelementbyid ("window_offsetx"). value = event. pagex-event. clientx;
- }
- If (! Isie ){
- Document. Forms [0]. addeventlistener ('submit ', window_onsubmitns, false );
- }
- Else {
- Document. Forms [0]. attachevent ('onsubmit ', window_onsubmitie );
- }
- Function lilistmonload (){
- Window. scrollto (0, 1431 );
- }
- If (! Isie ){
- Window. addeventlistener ('load', lilistmonload, false );
- }
- Else {
- Window. attachevent ('onload', lilistmonload );
- }
- </SCRIPT>
Method 2:
# _ Ctl0_btncanceldetail 'button position