JS implementation of keyboard key combination to achieve page jump

Source: Internet
Author: User

Use the keyboard to implement page jumps. To change the location back to the address you want to jump, the example is to use the direction key to achieve MovableType log page of the previous, after a jump code.

/tbody>
  code is as follows copy code

<script Language=javascript>
    document.onkeydown = chang_page;
    function Chang_page () {
        if (Event.keycode = 37 | | Event.keycode = location = ' <MTEntryPrevious>< $MTEntryPermalink $></mtentryprevious> ';
        if (Event.keycode = | | event.keycode = =) Location = ' <mtentrynex t>< $MTEntryPermalink $></mtentrynext> '
   }
</script>

P.S. Numeric code corresponding to commonly used keys:


A (65), B (66), C (67), D (68), E (69), F (70), G (71), H (72), I (73), J (74), K (75), L (76), M (77), N (78), O (79), P (80), Q (81), R (82), S (83), T (84), U (85), V (86), W (87), X (88), Y (89), Z (90), 0 (48), 1 (49), 2 (50), 3 (51), 4 (52), 5 (53), 6 (54), 7 (55), 8 (56), 9 (57), The top (38), lower (40), left (37), and right (39) of the direction key.

Some common page jump codes

The code is as follows Copy Code

First type:
<script language= "javascript" type= "Text/javascript" >
window.location.href= "Login.jsp?backurl=" +WINDOW.LOCATION.HREF;
</script>

The second type:
<script language= "JavaScript" >
Alert ("return");
Window.history.back (-1);
</script>

The third type:
<script language= "JavaScript" >
Window.navigate ("top.jsp");
</script>

The fourth kind:
<script language= "JavaScript" >
self.location= ' top.htm ';
</script>

The fifth kind:
<script language= "JavaScript" >
Alert ("Illegal access!) ");
top.location= ' xx.jsp ';
</script>

Finally attach a CTRL + Return to submit the form

  code is as follows copy code

<script Language=javascript>
ie = (document.all)? True:false
if (ie) {
function ctlent (eventobject) {if ( Event.ctrlkey && window.event.keycode==13) {this.document.form1.submit ();}}
}
</script>
<form action= "www.111cn.net" Method=post name=form1>
<textarea cols=95 Name =content rows=12 wrap=virtual onkeydown=ctlent ()
Ctrl+enter submit content Information
</textarea>
<input type= Submit Value= "Submit" Name=submit>
</form>

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.