Post by ialex on May 5, 2008 1:34:57 GMT -8
When you type a number into the page jump input field, this code will allow you to press enter to take you to that page, rather than you having to move your cursor a few pixels to the right and clicking 'Go'.
Cross Browser.
Global Footer.
<script type="text/javascript">
<!--
/*Hit Enter for Page Jump - Idea by Sissorelle - Coded By iAlex - Open Source*/
var iHit_Enter={
iLocate_Jump: function(){
if(document.getElementById('pageNo1')){
this.iApply_Function('pageNo1');
}
if(document.getElementById('pageNo2')){
this.iApply_Function('pageNo2');
}
},
iApply_Function: function(iJump_Number){
var iJump_Tag=document.getElementById(iJump_Number);
iJump_Tag.onkeydown=function(event){
if(event && event.which==13 || window.event && window.event.keyCode==13){
iHit_Enter.iPage_Jump(this);
}
}
},
iPage_Jump: function(iJump_Tag){
var iJump_Span = iJump_Tag.parentNode.parentNode.parentNode.getElementsByTagName('span').item(0);
var iJump_Link = iJump_Span.getElementsByTagName('a').item(0);
if(iJump_Tag.value!="" && iJump_Tag.value>0 && iJump_Tag.value<=parseInt(iJump_Link.innerHTML)){
window.location=iJump_Link.href.replace(/page=(\d+)$/, 'page='+iJump_Tag.value);
}
else{
alert('Invalid page number');
}
}
}
iHit_Enter.iLocate_Jump();
//-->
</script>
Cross Browser.
Global Footer.
<script type="text/javascript">
<!--
/*Hit Enter for Page Jump - Idea by Sissorelle - Coded By iAlex - Open Source*/
var iHit_Enter={
iLocate_Jump: function(){
if(document.getElementById('pageNo1')){
this.iApply_Function('pageNo1');
}
if(document.getElementById('pageNo2')){
this.iApply_Function('pageNo2');
}
},
iApply_Function: function(iJump_Number){
var iJump_Tag=document.getElementById(iJump_Number);
iJump_Tag.onkeydown=function(event){
if(event && event.which==13 || window.event && window.event.keyCode==13){
iHit_Enter.iPage_Jump(this);
}
}
},
iPage_Jump: function(iJump_Tag){
var iJump_Span = iJump_Tag.parentNode.parentNode.parentNode.getElementsByTagName('span').item(0);
var iJump_Link = iJump_Span.getElementsByTagName('a').item(0);
if(iJump_Tag.value!="" && iJump_Tag.value>0 && iJump_Tag.value<=parseInt(iJump_Link.innerHTML)){
window.location=iJump_Link.href.replace(/page=(\d+)$/, 'page='+iJump_Tag.value);
}
else{
alert('Invalid page number');
}
}
}
iHit_Enter.iLocate_Jump();
//-->
</script>