JavaScript Practical Skills Collection (4)

Source: Internet
Author: User
Tags add date exit error handling flush net window
Skills

31.TEXTAREA the number of adaptive lines of text

<textarea Rows=1 name=s1 cols=27 onpropertychange= "This.style.posheight=this.scrollheight" >
</textarea>


32. Date minus days equals second date

<script language=javascript>
function cc (DD,DADD)
{
You can add error handling
var a = new Date (DD)
A = A.valueof ()
A = A-dadd * 24 * 60 * 60 * 1000
A = new Date (a)
Alert (a.getfullyear () + "year" + (A.getmonth () + 1) + "month" + a.getdate () + "Day")
}
CC ("12/23/2002", 2)
</script>

33. Which radio was chosen

function Checkme ()
For each OB in Radio1
If ob.checked then Window.alert ob.value
Next
End Function
</script><BODY>
<input name= "Radio1" type= "Radio" value= "style" Checked>style
<input name= "Radio1" type= "Radio" value= "barcode" >barcode
<input type= "button" value= "Check" >
</BODY></HTML>

34. Script never Goes wrong

<script language= "JavaScript" >
<!--Hide
function Killerrors () {
return true;
}
Window.onerror = killerrors;
-->
</SCRIPT>

The 35.ENTER key allows the cursor to move to the next input box

<input >

36. Detect the link speed of a website:

Add the following code to the <body> area:

<script language=javascript>
tim=1
setinterval ("tim++", MB)
B=1
var autourl=new Array ()
Autourl= "Www.njcatv.net"
autourl= "javacool.3322.net"
autourl= "www.sina.com.cn"
Autourl= " www.nuaa.edu.cn "
autourl=" www.cctv.com
Function Butt () {
document.write ("<form name=autof>")
for (Var i=1;i<autourl.length;i++)
document.write ("<input type=text name=txt" +i+ "size=10 value= Test ......> =" <input type=text
Name=url "+i+" size=40> = "<input Type=button value=go

Onclick=window.open (This.form.url "+i+". Value) ><br> ")
document.write ("<input type=submit value= Refresh ></form>")
}
Butt ()
function Auto (URL) {
document.forms[0]["url" +b].value=url
if (tim>200)
{document.forms[0]["txt" +b].value= "link Timeout"}
Else
{document.forms[0]["txt" +b].value= "time" +tim/10+ "Seconds"}
b++
}
function run () {for (Var i=1;i<autourl.length;i++) document.write ("

Onerror=auto ("http://" +autourl+ "") >)}
Run () </script>

37. Various styles of cursors

Auto: Standard cursor
Default: Standard arrow
Hand: hand-shaped cursor
Wait: Waiting for cursor
Text:i-shaped cursor
Vertical-text: Horizontal i-type cursor
No-drop: Non-drag cursor
Not-allowed: Invalid cursor
Help:? Helper cursors
All-scroll: Triangle directional Sign
Move: Moving the label
Crosshair: Cross Mark
E-resize
N-resize
Nw-resize
W-resize
S-resize
Se-resize
Sw-resize


38. Page entry and exit effects

Enter page <meta http-equiv= "Page-enter" content= "Revealtrans (duration=x, transition=y)" >
Launch page <meta http-equiv= "Page-exit" content= "Revealtrans (duration=x, transition=y)" >
This is some special effects when the page is loaded and paged out. Duration represents the duration, in seconds, of the effect. Transition indicates which effect to use, with a value of 1-23:
0 Rectangle Shrink
1 Rectangle Enlargement
2 round Shrink
3 Circular Enlargement
4 down to top refresh
5 Top to bottom refresh
6 Left to right refresh
7 Right to left flush
8 Vertical Blinds
9 Horizontal Blinds
10 Dislocation Horizontal Blinds
11 Misplaced Vertical Blinds
12 Point spread
13 or so to the middle of the refresh
14 Middle to left flush
15 Middle to bottom
16 up and down to the middle.
17 right down to top left
18 top right to bottom left
19 top left to bottom right
20 left down to top right
21 Cross Bar
22 Vertical Bar
23 or more of 22 randomly selected one

39. Jump within a specified time

<meta http-equiv=v= "REFRESH" content= "5; Url=http://www.51js.com ">

40. Whether the Web page has been retrieved

<meta name= "content=" Property value >
There are some of the following property values:
The property value is "All": The file will be retrieved and the link on the page can be queried;
The property value is "None": The file is not retrieved and the link on the page is not queried;
The property value is "index": The file will be retrieved;
Property value is "Follow": a link on the query page;
The property value is "Noindex": The file is not retrieved but can be queried for links;
The property value is "nofollow": The file is not retrieved, but the link on the page can be queried.



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.