Javascript in the 61 most commonly used classical techniques

Javascript in the most commonly used collection of 61 classic techniques
1. Oncontextmenu = "window.event.returnValue = false" will completely shield Right
<table border oncontextmenu=return(false)> <td> no </ table> can be used for Table
2. <body Onselectstart="return false"> deselect to prevent copying

3. Onpaste = "return false" are not allowed to paste

4. Oncopy = "return false;" oncut = "return false;" to prevent copying

5. <link Rel="Shortcut Icon" href="favicon.ico"> IE address bar into your own icons before

6. <link Rel="Bookmark" href="favicon.ico"> can be shown in the Favorites icon on your

7. <input> Off input

8.'ll Always be with the framework
<script language="JavaScript"> <! -
if (window == top) top.location.href = "frames.htm"; / / frames.htm the framework of the page
/ / --></ Script>

9. Prevention of the frame
<SCRIPT LANGUAGE=JAVASCRIPT> <! -
if (top.location! = self.location) top.location = self.location;
/ / --></ SCRIPT>

10. Page will not be saved as
<noscript> <*** src ="/*. html >";</***></ noscript>

11. <Input type = button value = "/ View page source
onclick = "window.location =" view-source: "+" http://www.pconline.com.cn "">
12. Deletion confirmation
<a href=""javascript :if(confirm(" Are you sure you want to delete? ?"))location="boos.asp?&areyou= Delete &page=1""> delete </ a>

13. To obtain the absolute position of the control
/ / Javascript
<script language="Javascript">
function getIE (e) {
var t = e.offsetTop;
var l = e.offsetLeft;
while (e = e.offsetParent) {
t + = e.offsetTop;
l + = e.offsetLeft;
}
alert ("top =" + t + "/ nleft =" + l);
}
</ Script>
/ / VBScript
<script language="VBScript"> <! -
function getIE ()
dim t, l, a, b
set a = document.all.img1
t = document.all.img1.offsetTop
l = document.all.img1.offsetLeft
while a.tagName <> "BODY"
set a = a.offsetParent
t = t + a.offsetTop
l = l + a.offsetLeft
wend
msgbox "top =" & t & chr (13) & "left =" & l, 64, "get control of the position"
end function
--></ Script>

14. Cursor is parked in the text of the final text box
<script language="javascript">
function cc ()
{
var e = event.srcElement;
var r = e.createTextRange ();
r.moveStart ("character", e.value.length);
r.collapse (true);
r.select ();
}
</ Script>
<input type=text name=text1 value="123">

15. To determine the source of previous
javascript:
document.referrer

16. Minimize, maximize, close window
<object"clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"> </ object>
<object"clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"> </ object>
<OBJECT"clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" value="/Close"> </ OBJECT>
<Input type = button value = "/ minimized
<Input type = button value = "/ blog / Maximize
<Input type = button value = close this case for IE

17. Shielding function keys Shift, Alt, Ctrl
<script>
function look () {
if (event.shiftKey)
alert ("prohibited by Shift key!"); / / can be replaced with ALT CTRL
}
document.onkeydown = look;
</ Script>

18. Page will not be cached
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
Or <META HTTP-EQUIV="expires" CONTENT="0">

19. How to make the form not of concavity?
<input type=text"border:1 solid #000000">
Or
<input type=text> </ textarea>

20. <div> <span> & <layer> The difference?
<div> (division) used to define a large section of the page elements will have to change jobs
<span> used to define the elements within the same line, with the only difference is that <div> switch does not produce
<layer> mark is ns, ie do not support, equivalent to <div>

21. Let the pop-up window always on top:
<body>

22. Do not scroll bar?
Let bars do not:
<body>
</ Body>
So there is no bar:
<body>
</ Body>
Two are removed? More simple
<body scroll="no">
</ Body>

23. How to remove the image link click, the dotted line around the picture?
<a href="#"> <img src="/logo.jpg" border=0> </ a>

24. E-mail Treatment submit the form
<Form name = "form1" method = "post" action = mailto :****@***. com
enctype = "text / plain">
<input type=submit>
</ Form>

25. In the child window open to refresh the parent window's code how to write?
window.opener.location.reload ()

26. How to set the size to open the page
<body onload="top.resizeTo(300,200);">
Open the page location <body onload="top.moveBy(300,200);">

27. In the page how to add a background picture is not paved, pull the background image when the page is fixed
<STYLE>
body
{Background-image: url (/ logo.gif); background-repeat: no-repeat;
background-position: center; background-attachment: fixed}
</ STYLE>

28. Check whether a string is composed entirely of numbers
<script language="Javascript"> <! -
function checkNum (str) {return str.match (/ / D /) == null}
alert (checkNum ("1232142141"))
alert (checkNum ("123214214a1"))
/ / --></ Script>

29. To obtain the size of a window
document.body.clientWidth; document.body.clientHeight

30. How to determine whether a character
if (/[^/ x00-/xff] / g.test (s)) alert ("with Chinese characters");
else alert ("all characters");

31.TEXTAREA Adaptive Text the number of rows
<Textarea rows = 1 name = s1 cols = 27 onpropertychange
= "This.style.posHeight = this.scrollHeight">
</ Textarea>

32. Date minus the number of days equal to the second date
<script language=Javascript>
function cc (dd, dadd)
{
/ / 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 () + "on" + (a.getMonth () + 1) + "on" + a.getDate () + "Day")
}
cc ("12/23/2002", 2)
</ Script>

33. Chose which one Radio
<HTML> <script Language="vbscript">
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="/blog/barcode"> Barcode
<INPUT Type="button" value="check">
</ BODY> </ HTML>

34. Script never wrong
<SCRIPT LANGUAGE="JavaScript">
<! - Hide
function killErrors () {
return true;
}
window.onerror = killErrors;
/ / ->
</ SCRIPT>

35.ENTER keys allow the cursor to the next input box
<input onkeydown="if(event.keyCode==13)event.keyCode=9">

36. Detection of a site's link speed:
The following code to <body> area:
<script language=Javascript>
tim = 1
setInterval ("tim + +", 100)
b = 1
var autourl = new Array ()
autourl [1] = 1000) {this.resized = true; this.style.width = 1000;} "align = absMiddle border = 0> life.netskycn.com"
autourl [2] = "javacool.3322.net"
autourl [3] = 1000) {this.resized = true; this.style.width = 1000;} "align = absMiddle border = 0> www.netskycn.com"
autourl [4] = "www.nuaa.edu.cn"
autourl [5] = 1000) {this.resized = true; this.style.width = 1000;} "align = absMiddle border = 0> bbs.netskycn.com"
function butt () {
***("< Form name = autof> ")
for (var i = 1; i <autourl.length; i + +)
***("< Input type = text name = txt "+ i +" size = 10 value = "/ test ... ...> =" <input type = text
name = url "+ i +" size = 40> = "<input type = button value =" / blog / GO
onclick = window.open (this.form.url "+ i +". value)> <br> ")
***("< 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 timed out"}
else
{Document.forms [0] ["txt" + b]. Value = "/ blog / time" + tim/10 + "seconds"}
b + +
}
function run () {for (var i = 1; i <autourl.length; i ++)***("< img src = http:// "+ autourl +"/"+ Math.random () +" width = 1 height = 1
onerror = auto ("http://" + autourl +"")>")}
run () </ script>

37. A variety of styles cursor
auto: standard cursor
default: the standard arrow
hand: hand cursor
wait: wait cursor
text: I-shaped cursor
vertical-text: horizontal I-shaped cursor
no-drop: drag the cursor is not
not-allowed: invalid cursor
help:? Help Cursor
all-scroll: Triangle direction indicator
move: mobile standard
crosshair: cross mark
e-resize
n-resize
nw-resize
w-resize
s-resize
se-resize
sw-resize

38. Page enter and exit the special effects into the page <meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
Introduction page <meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">
This is the page is loaded and transferred out to some of the special effects. that the duration of effect duration, in seconds. What kind of transition that the use of special effects, the value is 1-23:
0 1 rectangular narrow narrow rectangular expansion of 2 round 3 round 4 of the bottom to expand on to the next refresh refresh 5 6 7 left to right, right to left refresh refresh 8 9 horizontal blinds vertical blinds horizontal blinds 10 Dislocation Dislocation of the vertical blinds 11, 12 spread among 13 or so to refresh refresh about 14 to 15 between the middle and down 16 and down to the middle to the lower right to upper left 18 upper right 17 left 19 left to bottom right to bottom left to upper right 20 bars 22 bars 21 22 of 23 randomly selected more than one species

39. Within the specified time jump
<META Http-equiv=V="REFRESH" content="5;URL=http://www.netskycn.com">

40. Web page is to be retrieved
<meta name="ROBOTS" content=" Property value ">
Where property values have the following:
Property value of "all": the file will be retrieved, and the page links may be inquiries;
Property value of "none": file is not retrieved, and do not check the links page;
Property value of "index": the file will be retrieved;
Property value of "follow": check the links on the page;
Property value of "noindex": file does not search, but can be queried links;
Property value of "nofollow": file is not retrieved, but can check the links page.

41, email addresses separated by adding the following code <body> area
<a href="mailto:webmaster@sina.com"> webmaster@sina.com </ a>

42, flow effects form the border the following code to <body> area
<SCRIPT>
l = Array (6,7,8,9, 'a', 'b', 'b', 'c', 'd', 'e', 'f')
Nx = 5; Ny = 35
t = "<table border=0 cellspacing=0 cellpadding=0 height="+((Nx+2)*16)+"> <tr>"
for (x = Nx; x <Nx + Ny; x + +)
t + = "<td width=16"+x+"> </ td>"
t +="</ tr> <tr> <td width=10"+(Nx-1)+"> </ td> <td colspan = "+ (Ny-2) +" rowspan = "+ (Nx) + "> </ td> <td width=16"+(Nx+Ny)+"> </ td> </ tr>"
for (x = 2; x <= Nx; x + +)
t + = "<tr> <td width=16"+(Nx-x)+"> </ td> <td width=16"+(Ny+Nx+x-1)+"> </ td> </ tr> "
t + = "<tr>"
for (x = Ny; x> 0; x -)
t + = "<td width=16"+(x+Nx*2+Ny-1)+"> </ td>"
*** (T + "</ tr> </ table>")
var N = Nx * 2 + Ny * 2
function f1 (y) {
for (i = 0; i <N; i + +) {
c = (i + y)% 20; if (c> 10) c = 20-c
document.all ["a_mo" + (i)]. bgColor =""""# 0000 "+ l [c] + l [c ]+"'"}
y + +
setTimeout ('f1 (' + y +')',' 1 ')}
f1 (1)
</ SCRIPT>

43, JavaScript pop-up tips home the middle of the pop-up window
<script>
window.open ("http://www.cctv.com ",""," width = 400, height = 240, top =" + (screen.availHeight-240) / 2 + ", left =" + (screen . availWidth-400) / 2);
</ Script>
============
<html>
<head>
<script language="LiveScript">
function WinOpen () {
msg = open (""," DisplayWindow "," toolbar = no, directories = no, menubar = no ");
msg .***("< HEAD> <TITLE> Hello! </ TITLE> </ HEAD> ");
msg .***("< CENTER> <H1> cool! </ H1> <h2> This is <B> JavaScript </ B> by the open window! </ h2> </ CENTER> ");
}
</ Script>
</ Head>
<body>
<form>
<input type="button" name="Button1" value="Push me">
</ Form>
</ Body>
</ Html>
==============
First, in the following code, you just click to open a window, you can link to the world network. And when you want to close, just one click you can close the window just opened.
Code:
<SCRIPT Language="JavaScript">
<! -
function openclk () {
another = open ('1000) {this.resized = true; this.style.width = 1000;} "align = absMiddle border = 0> www.netskycn.com ',' NewWindow ');
}
function closeclk () {
another.close ();
}
//-->
</ SCRIPT>
<FORM>
<INPUT TYPE="BUTTON" NAME="open" value="/ Opens a window ">
<BR>
<INPUT TYPE="BUTTON" NAME="close" value="/blog/ Close this window ">
</ FORM>
Second, the above code is too quiet, why not to point movement it? If a landing page to give effect that nice ah!
Code:
<script>
function drop (n) {
if (self.moveBy) {
self.moveBy (0, -900);
for (i = n; i> 0; i -) {
self.moveBy (0,3);
}
for (j = 8; j> 0; j -) {
self.moveBy (0, j);
self.moveBy (j, 0);
self.moveBy (0,-j);
self.moveBy (-j, 0);
}
}
}
</ Script>
<body onLoad="drop(300)">
Third, many sites are always annoying window open by default, if you can arbitrarily control the open window that would be great.
Code:
<SCRIPT LANGUAGE="JavaScript">
<! - Begin
function popupPage (l, t, w, h) {
var windowprops = "location = no, scrollbars = no, menubars = no, toolbars = no, resizable = yes" +
", Left =" + l + ", top =" + t + ", width =" + w + ", height =" + h;
var URL = "http://www.netskycn.com";
popup = window.open (URL, "MenuPopup", windowprops);
}
/ / End ->
</ Script>
<table>
<tr>
<td>
<form name=popupform>
<pre>
Open the pages of the parameters <br>
Distance away on the left: <input type=text name=left size=2 maxlength=4> pixels
Left right away: <input type=text name=top size=2 maxlength=4> pixels
Width of the window: <input type=text name=width size=2 maxlength=4> pixels
Window height: <input type=text name=height size=2 maxlength=4> pixels
</ Pre>
<center>
<Input type = button value = "open the window!" "PopupPage (this.form.left.value, this.form.top.value, this.form.width.value,
this.form.height.value) ">
</ Center>
</ Form>
</ Td>
</ Tr>
</ Table> you have to do in the corresponding dialog box, enter a value to, the page will open a window well under control.

44, moved to open the page the following code to <body> area
<SCRIPT LANGUAGE="JavaScript">
<! - Begin
for (t = 2; t> 0; t -) {
for (x = 20; x> 0; x -) {
for (y = 10; y> 0; y -) {
parent.moveBy (0,-x);
}
}
for (x = 20; x> 0; x -) {
for (y = 10; y> 0; y -) {
parent.moveBy (0, x);
}
}
for (x = 20; x> 0; x -) {
for (y = 10; y> 0; y -) {
parent.moveBy (x, 0);
}
}
for (x = 20; x> 0; x -) {
for (y = 10; y> 0; y -) {
parent.moveBy (-x, 0);
}
}
}
//-->
/ / End ->
</ Script>

45, shows individual client machine date and time
<script language="LiveScript">
<! - Hiding
today = new Date ()
***(" Time now is: ", today.getHours (),":", today.getMinutes ())
***("< Br> today's date is: ", today.getMonth () +1 ,"/", today.getDate (),"/", today.getYear ());
/ / End hiding contents ->
</ Script>

46, automatically generated for you every time the date of last modification:
<html>
<body>
This is a simple HTML-page.
<br>
Last changes:
<script language="LiveScript">
<! - Hide script from old browsers
*** (Document.lastModified)
/ / End hiding contents ->
</ Script>
</ Body>
</ Html>

47, e-mail address can not be empty and the constraints:
<html>
<head>
<script language="JavaScript">
<! - Hide
function test1 (form) {
if (form.text1.value == "")
alert ("You did not write anything, please enter it again!")
else {
alert ("Hello" + form.text1.value + "! you have entered complete!");
}
}
function test2 (form) {
if (form.text2.value == "" | |
form.text2.value.indexOf ('@', 0) == -1)
alert ("This is not the correct e-mail address! Please enter it again!");
else alert ("You have entered complete!");
}
/ / ->
</ Script>
</ Head>
<body>
<form name="first">
Enter your name: <br>
<input type="text" name="text1">
<input type="button" name="button1" value=" Enter test ">
<P>
Enter your e-mail address: <br>
<input type="text" name="text2">
<input type="button" name="button2" value=" Enter test ">
</ Body>

48, Marquee
<html>
<head>
<script language="JavaScript">
<! - Hide
var scrtxt = "how to! Pretty cool, huh! You can also try." + "Here goes your message the visitors to your
page will "+" look at for hours in pure fascination ...";
var lentxt = scrtxt.length;
var width = 100;
var pos = 1-width;
function scroll () {
pos + +;
var scroller = "";
if (pos == lentxt) {
pos = 1-width;
}
if (pos <0) {
for (var i = 1; i <= Math.abs (pos); i + +) {
scroller = scroller + "";}
scroller = scroller + scrtxt.substring (0, width-i +1);
}
else {
scroller = scroller + scrtxt.substring (pos, width + pos);
}
window.status = scroller;
setTimeout ("scroll ()", 150);
}
//-->
</ Script>
</ Head>
<body onLoad="scroll();return true;">
Here you can display your page!
</ Body>
</ Html>

49, using buttons to control the page previous page, page after page and display.
<html>
<body>
<FORM NAME="buttonbar">
<INPUT TYPE="button" VALUE="Back">
<INPUT TYPE="button" VALUE="JS- Home">
<INPUT TYPE="button" VALUE="Next">
</ FORM>
</ Body>
</ Html>
50, view the source code of a web site by adding the following code <body> area
<SCRIPT>
function add ()
{
var ress = document.forms [0]. luxiaoqing.value
window.location = "view-source:" + ress;
}
</ SCRIPT>
Enter the URL address of the source code view:
<FORM> <input Type="text" name="luxiaoqing" size=40 value="http://"> </ FORM>
<FORM> <br>
<INPUT type = "button" value = "View Source"
</ FORM>

51, title the following code to display the date the <body> area:
<script language="JavaScript1.2">
<! - Hide
var isnMonth = new
Array ("1 month", "February", "March", "April", "May", "June", "July", "August" "September", "October "" November "," December ");
var isnDay = new
Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" "Sunday");
today = new Date ();
Year = today.getYear ();
Date = today.getDate ();
if (document.all)
document.title = "Today is:" + Year + "on" + isnMonth [today.getMonth ()] + Date + "at" + isnDay [today.getDay ()]
/ / - Hide ->
</ Script>

52, showing all the links to the following code to <body> area
<script language="JavaScript1.2">
<! -
function extractlinks () {
var links = document.all.tags ("A")
var total = links.length
var win2 = window.open ("",""," menubar, scrollbars, toolbar ")
win2 .***("< font size = '2 '> A total of "+ total +" connections </ font> <br> ")
for (i = 0; i <total; i + +) {
win2 .***("< font size = '2 '> "+ links [i]. outerHTML +" </ font> <br> ")
}
}
//-->
</ Script>
<input type="button" value=" Displays all connections ">

53 Enter the following code line to add <body> area
<script type="text/javascript">
function handleEnter (field, event) {
var keyCode = event.keyCode? event.keyCode: event.which?
event.which: event.charCode;
if (keyCode == 13) {
var i;
for (i = 0; i <field.form.elements.length; i + +)
if (field == field.form.elements [i])
break;
i = (i + 1)% field.form.elements.length;
field.form.elements [i]. focus ();
return false;
}
else
return true;
}
</ Script>
<form>
<input type="text" onkeypress="return handleEnter(this, event)"> <br>
<input type="text" onkeypress="return handleEnter(this, event)"> <br>
<textarea> CRLF

54, confirm the following code to submit to <body> area
<SCRIPT LANGUAGE="JavaScript">
<! -
function msg () {
if (confirm ("Are you sure you want to submit it!"))
document.lnman.submit ()
}
//-->
</ SCRIPT>
<form name="lnman" method="post" action="">
<p>
<input type="text" name="textfield" value=" Confirm and submit ">
</ P>
<p>
<input type="button" name="Submit" value=" Submit ">
</ P>
</ Form>

55, changing the contents of the table following code to <body> area
<script ***script>
var arr = new Array ()
arr [0] = "eleven thousand one hundred eleven";
arr [1] = "twenty-two thousand two hundred twenty-two";
arr [2] = "thirty-three thousand three hundred thirty-three";
</ Script>
<select onchange="zz.cells[this.selectedIndex].innerHTML=arr[this.selectedIndex]">
<option value=a> change the first cell </ option>
<option value=a> change the second cell </ option>
<option value=a> change the third one </ option>
</ Select>
<Table
<tr height=20>
<td width=150> first cell </ td>
<td width=150> second cell </ td>
<td width=150> the third cell </ td>
</ Tr>
</ Table>

56 for the current browser address URL:
<script language="JavaScript">
var myURL = document.URL;
window.alert (myURL);
</ Script>

57 time to execute the function
<script>
<! -
function hello ()
{
window.alert ("Hello");
window.setTimeout ("hello ()", 5000);
}
window.setTimeout ("hello ()", 5000);
/ / ->
</ Script>

58 cancel the execution time
<script>
<! -
function hello ()
{
window.alert ("Hello");
}
var myTimeout = window.setTimeout ("hello ()", 5000);
window.clearTimeout (myTimeout);
/ / ->
</ Script>

59 read URL parameters
<script language="JavaScript">
var urlParts = document.URL.split ("?");
var parameterParts = urlParts [1]. split ("&");
for (i = 0; i <parameterParts.length; i + +)
{
var pairParts = parameterParts [i]. split ("=");
var pairName = pairParts [0];
var pairValue = pairParts [1];
document.write (pairName + ":" + pairValue);
}
</ Script>

60 read Image Properties
<img src="/image1.jpg" name="myImage">
<a href="# ""window.alert(document.myImage.width)"> Width </ a>

Create slide 61
<script language="JavaScript">
var imageList = new Array;
imageList [0] = new Image;
imageList [0]. src = "image1.jpg";
imageList [1] = new Image;
imageList [1]. src = "image2.jpg";
imageList [2] = new Image;
imageList [2]. src = "image3.jpg";
imageList [3] = new Image;
imageList [3]. src = "image4.jpg";
function slideShow (imageNumber) {
document.slideShow.src = imageList [imageNumber]. src;
imageNumber + = 1;
if (imageNumber <imageList.length) {
window.setTimeout ("slideShow (" + imageNumber + ")", 3000);
}
}
</ Script>
</ Head>
<body onLoad="slideShow(0)">
<img src="/"image1.jpg"" width=100 name="slideShow">

This article comes from CSDN blog, reproduced, please credit: http://blog.csdn.net/zhoufoxcn/archive/2007/08/11/1737830.aspx

分类:Web 时间:2010-12-07 人气:209
分享到:
blog comments powered by Disqus

相关文章

  • javascript中input中readonly和disabled区别介绍 2013-12-17

    javascript中input中readonly和disabled区别,在开发中可能会常有用到,利用js动态改变input的属性 Readonly和Disabled是用在表单中的两个属性,它们都能够做到使用户不能够更改表单域中的内容。但是它们之间有着微小的差别,总结如下: Readonly只针对input(text / password)和textarea有效,而disabled对于所有的表单元素都有效,包括select, radio, checkbox, button等。但是表单元素在使用了

  • 利用JavaScript更改input中radio和checkbox样式 2014-04-11

    利用JavaScript更改input中radio和checkbox样式的实现代码。 本文涉及到的图片 利用javascript自定义radio及checkbox样式 单选框样式: 男 女 boy girl 复选框样式: xhtml CSS Javascript Flash Ajax AS Flex PHP/.NET/JSP 了解 一般 熟练 精通 资深专家 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

  • javascript 控制input只允许输入的各种指定内容 2014-05-03

    这篇文章主要介绍了通过javascript控制input只允许输入的各种指定内容,需要的朋友可以参考下 1、只允许输入数字 <input name="username" type="text" onkeyup="value=this.value.replace(/\D+/g,'')"> 2、只允许输入英文字母、数字和下划线(以下二种方法实现) <input name="username" type="text" style="ime-mode:disabled">

  • Javascript控制input输入时间格式的方法 2014-08-29

    这篇文章主要介绍了Javascript控制input输入时间格式的方法,涉及鼠标事件及正则表达式的灵活应用,需要的朋友可以参考下 本文实例讲述了Javascript控制input输入时间格式的方法。分享给大家供大家参考。具体分析如下: 之前做了一个Javascript控制时间格式的输入,主要用到了keydown和keyup两个事件,但感觉写的很复杂而且还有bug。 今日了解了一下keypress事件与keydown和keyup的区别。大致如下(目前只了解这么多): keydown:按键按下的时候

  • Javascript 55 most commonly used classical techniques 2010-03-28

    1. Oncontextmenu = "window.event.returnValue = false" will completely shield Right <table border oncontextmenu=return(false)> <td> no </ table> can be used for Table 2. <body Onselectstart="return false"> desele

  • [Change] javascript the 55 most commonly used classical techniques (41-55) 2010-04-24

    javascript in the 55 most commonly used classical techniques (41-55) 1. Oncontextmenu = "window.event.returnValue = false" will completely shield Right <table border oncontextmenu=return(false)> <td> no </ table> can be used fo

  • JavaScript The most commonly used classical techniques of 55 2010-07-26

    1. Oncontextmenu = "window.event.returnValue = false" will completely shield Right <table border oncontextmenu=return(false)> <td> no </ table> can be used for Table 2. <body Onselectstart="return false"> desele

  • Javascript in the 55 most commonly used classical techniques 2010-08-25

    1. oncontextmenu="window.event.returnValue=false" Will completely shield Right <table border oncontextmenu=return(false)><td>no</table> Can be used Table 2. <body onselectstart="return false"> Deselect. To prevent the replication 3

  • Javascript in the 55 most commonly used classical techniques - very useful 2010-12-24

    <table border oncontextmenu=return(false)> <td> no </ table> can be used for Table 2. <body Onselectstart="return false"> deselect to prevent copying 3. Onpaste = "return false" are not allowed to paste 4. Oncop

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.450 (s). 12 q(s)