[Personal summary] common skills in Asp.net Development

Source: Internet
Author: User
1. implement automatic jump of text box focus and submit the form through the Enter key < ASP: textbox ID = "Passwd" Onkeydown = "If (event. keycode = 13) {document. All. imgbtnlogin. Focus (); event. keycode = 13; event. keycode = 13; return true ;}" Runat = "Server" Borderstyle = "Ridge" Textmode = "Password" > </ ASP: textbox >

In document. All. imgbtnlogin. Focus (); imgbtnlogin is the ID of the submit button

2. Get Page focusPage. registerstartupscript ("Getfocus","<SCRIPT> document. All ('"+Textbox1.clientid+"'). Focus (); </SCRIPT>");

Textbox1 is a web control, and textbox1.clientid is used to obtain the ID of the Web Control and send it to the client.

3. Clear cookies < Script Language = " Javascript " >
Function Clearbrowsedcookie ()
{
Document. Cookie= "Yourcookies=; Expires = Fri, 25-dec-1999 08:08:08 GMT; Path =/";
Document. getelementbyid ('browsedproductlist1 _ tabbrowsedproduct'). style. Display= "None";
}
</ Script >

Yourcookies are the names of the cookies you want to clear.
Call

< A Href = "Javascript: clearbrowsedcookie ();" > Clear cookie </ A >

4. Make the specified HTML domain invisible. The specified HTML domain is displayed after you click the specified link.
Example:

< Table ID = "Tab1" >
  < Tr >
< TD >
Test
</ TD >
  </ Tr >
</ Table >
< A Onclick = "Tabshow ();" Href = "#" >
< Script Language = " Javascript " >
Tab1.style. Display = " None " ;
Function Tabshow ()
{
If (Tab1.style. Display = " None " )
{
Tab1.style. Display="";
}
Else
{
Tab1.style. Display="None";
}
}
</ Script >

Function:
// ID of the tab table
Function Tabshow (Tab)
{
VaR Tabname = Document. getelementbyid (Tab );
If (Tabname. style. Display = " None " )
{
Tabname. style. Display="";
}
Else
{
Tabname. style. Display="None";
}
}
</ Script >

Related Article

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.