讓表單提交返回後保持在原來提交的位置上
阿新 • • 發佈:2019-02-08
-
<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 Lili1_OnLoad(){
-
window.scrollTo(0,1431);
-
}
-
if (!isIE){
-
window.addEventListener('load',Lili1_OnLoad, false);
-
}
-
else{
-
window.attachEvent('onload',Lili1_OnLoad);
-
}
- </script>