Miscellaneous --

Source: Internet
Author: User


Tip 1-prevent JS from caching CSS as well
<SCRIPT type = "text/JavaScript" Language = "JavaScript" src = "../JS/checksfz. js? Temp = <% = datetime. Now. ticks %> "> </SCRIPT>
******************************
Prohibit copying, cutting, and right-built

Oncontextmenu = "event. returnvalue = false" oncopy = "event. returnvalue = false"
Oncut = "event. returnvalue = false"

The text box cannot be automatically recorded.
AutoComplete = "off"
******************************
· Hyperjoin Style
******************************
A: link refers to a normal link that has not been accessed;
A: hover refers to the mouse over the link;
A: The link of active vertices;
A: visited refers to the accessed link.
 
Parameter settings:
 
Text-decoration indicates the effect of text modification; none indicates that the hyperlink text is not underlined; Underline indicates that the hyperlink text is underlined; overline indicates that the hyperlink text is underlined; line-through is used to delete the hyperlink text. Blink is used to make the text flash.
 
Color: blue, color: Red, etc. are used to add color to the link text.
 
You can also add other parameters, such:
 
Font-weight: bold to bold the link text; font-size: 16pt to set the link text font size; Background: # ffd306 to add the background color to the link text; font-style: italic link text skew; border-bottom: 1px dashed #51bfe0 adds a dotted line to the link text. 1px indicates the coarse granularity of the dotted line. The larger the value, the thicker the dashed indicates the dotted line, #51bfe0 is the dotted line color. If you want to add a dotted line to the link text, you do not need to underline it.
************************************

· Response clear
************************************

Response. expires = 0; // set the validity period
Response. Buffer = true; // use the cache Region
Response. Clear (); // clear response
Response. contenttype = "image/PNG"; // specify the output type.
Response. statuscode = 200;
Response. End ();
************************************
· Webrequest Column
************************************
Response. Clear ();

Httpwebrequest request = (httpwebrequest) webrequest. Create (@ "http://www1.fx168.com/fxindex/FMonthIndex.aspx? Datetime = 2007-10-16 "); // get a URL request
Httpwebresponse response = (httpwebresponse) request. getresponse (); // get the output stream object
Stream resstream = response. getresponsestream (); // gets the output stream
Byte [] Buf = new byte [1, 1024];
Int COUNT = 0;
While (COUNT = resstream. Read (BUF, 0, Buf. Length)> 0) // convert the stream into a byte sequence
{
Response. write (system. text. encoding. default. getstring (BUF, 0, count ). replace ("oncontextmenu =/" Return false;/"onselectstart =/" Return false;/"oncopy =/" Return false;/"oncut =/" Return false; /"", ""); // print the characters in the throttling and replace the JS script
}
Resstream. Close ();

*****************************

Window. open () attributes
****************************

Window. open (URL, 'Pop-up window 'height = 455, width = 655, Top = 50, Left = 300, toolbar = No, menubar = No, scrollbars = No, resizable = No, location = No, status = Yes, charset = UTF-8 ')

****************************

Determine the browser type window. Navigator. appname
Judge IE version window. Navigator. appversion
Determine the client's resolution window. Screen. height; window. Screen. width;

***************************
The value of all forms cannot be blank. <input onblur = "If (this. value. replace (/^/S + |/S + $/g, '') ='') Alert ('cannot be blank! ') ">

1. Email judgment.
Function Ismail (Mail)
{
Return (New Regexp (/^/W + (-/W +) | (/./W +) */@ [A-Za-z0-9] + (/. | -)
[A-Za-z0-9] +) */. [A-Za-z0-9] + $/). Test (Mail ));
}

 

2. ID card verification
Function isidcardno (Num)
{
If (isnan (Num) {alert ("the input is not a number! "); Return false ;}
VaR Len = num. length, RE;
If (LEN = 15)
Re = new Regexp (/^ (/d {6 })()? (/D {2}) (/d {2}) (/d {2}) (/d {3}) $ /);
Else if (LEN = 18)
Re = new Regexp (/^ (/d {6 })()? (/D {4}) (/d {2}) (/d {2}) (/d {3}) (/d) $ /);
Else {alert ("the number of digits entered is incorrect! "); Return false ;}
VaR A = num. Match (re );
If (! = NULL)
{
If (LEN = 15)
{
VaR d = new date ("19" + A [3] + "/" + A [4] + "/" + A [5]);
VaR B = D. getyear () = A [3] & (D. getmonth () + 1) = A [4] &
D. getdate () = A [5];
}
Else
{
VaR d = new date (A [3] + "/" + A [4] + "/" + A [5]);
VaR B = D. getfullyear () = A [3] & (D. getmonth () + 1) = A [4] &
D. getdate () = A [5];
}
If (! B) {alert ("entered ID card number" + A [0] + "contains incorrect birthdate! "); Return false ;}
}
Return true;
}


3. Determine the file type during File Upload
<Input type = file onchange = "alert (this. value. match (/^ (. *)(/.) (. {1, 8}) $/) [3]) ">

4. Continuously clear the clipboard:
<Body onload = "setinterval ('clipboarddata. setdata (/'text/',/') ', 100)">

5. File: // window. opener. Location. Reload (); refresh the parent window.
6. File: // window. opener. Location = "2.htm" // The target parent window is displayed on the 2.htm page.

7. Description: How long does it take for a webpage to refresh itself (in seconds), or how long does it take for the webpage to automatically link to another webpage.
Usage: <meta http-equiv = "refresh" content = "30">
<Meta http-equiv = "refresh" content = "5; url = http://www.xia8.net">

8. SQL calculates the number of days in a month
Select Day (dateadd (day,-1, convert (char (07), dateadd (month, 1, @ date), 120) + '-01 '))

9. url Transcoding
Src = "drawing. aspx? Ccoms = <% = server. urlencode (ccoms) %>"

10. Save the current webpage location
Smartnavigation = true --- added to the page attribute

11. custom exception classes

Public class myexception: applicationexception

 

{
Public myexception (): Base ()

{

}

/// <Param name = "errmessage"> exception message </param>

Public myexception (string message): Base (Message)
{

System. Web. httpcontext. Current. response. Redirect ("~ /Showerr. aspx? MSG = "+ message );

}

/// <Param name = "message"> exception message </param>
/// <Param name = "innerexception"> exception class that causes this exception </param>
Public myexception (string message, exception innerexception): Base (message, innerexception)
{

}

}

12. ifream auto-fit size
Onload = "This. Height = document.frames%02.16.doc ument. Body. scrollheight"

 

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.