[ASP. NET] button jump and press enter to submit with different parameters, and other induction events

Source: Internet
Author: User

1. The simplest method

<Head>


 
<Script language = "JavaScript" event = "onkeydown" for = "document">

<! --

If (event. keycode = 13) & event. srcelement. type! = 'Button '& event. srcelement. type! = 'Submit '& event. srcelement. type! = 'Reset' & event. srcelement. type! = '')

Event. keycode = 9;

-->

<SCRIPT>

</Head>

2. unlimited control

<HTML>

<Head>

<Meta http-equiv = "content-language" content = "ZH-CN">

<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">

<Title> key jump test </title>

<Script language = JavaScript>

Function keypress ()

{

Akey = event. keycode;

If (akey = 13)

{

Gotourl = 'Find. aspx? '+ Event. srcelement. Name +' = '+ event. srcelement. value;

Window. Open (gotourl );

}

}

Function keytab1 (Event)

{

Akey = event. keycode;

If (akey = 13)

{

Document. Forms [0]. useraddr. Focus ();

}

}

Function keytab2 (Event)

{

Akey = event. keycode;

If (akey = 13)

{

Document. Forms [0]. userphone. Focus ();

}

}

Function converttoupper (textbox)

{

Textbox. value = textbox. value. touppercase ();

}

Function checknum (STR)

{

Return Str. Match (/D/) = NULL

}

 

</SCRIPT>

<Style>

<! --

Body {font-size: 10pt; font-family:}

Div {border-style: Ridge; border-width: 1px; padding: 10px; Background-color: # daf4fe}

-->

</Style>

</Head>

<Body onload = "javascript: Document. Forms [0]. userid. Focus ()">

<Div style = "width = 254px; Height: 134px">

<Form method = "Post">

<B> query condition </B>

<HR>

User code: <input type = "text" name = "userid" size = "20" onmouseover = "this. focus () "onkeypress =" keypress () "onfocus =" this. select () "> <font face =" webdings "> n </font> <br>

User name: <input type = "text" name = "username" size = "20" onmouseover = "this. focus () "onkeypress =" keypress () "onfocus =" this. select () "> <font face =" webdings "> n </font> <br>

User Phone: <input type = "text" name = "userphone" onmouseover = "this. focus () "onchange =" converttoupper (this) "onkeypress =" keytab1 (event) "onfocus =" this. select () "> <br>

User address: <input type = "text" name = "useraddr" onmouseover = "this. focus () "onchange =" converttoupper (this) "onkeypress =" keytab2 (event) "onfocus =" this. select () ">

</Form>

</Div>

</Body>

</Html>



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.