


Share the 55 most commonly used classic tips in Javascript_javascript tips
1. oncontextmenu="window.event.returnValue=false" will completely block the right mouse button
no |
2.
Cancel selection and prevent copying3. onpaste="return false" No pasting allowed
4. oncopy="return false;" oncut="return false;" Prevent copying
5. Replace the IE address bar with your own icon
6. can display your icon in favorites
7. Turn off input method
8. Always carry frames
9. Prevent being framed
10. Web pages will not be saved as
11.
12. Confirm when deleting
Delete
13. Get the absolute position of the control
//Javascript
//VBScript
14. The cursor is stopped at the end of the text box text
15. 判断上一页的来源
javascript :
document.referrer
16. 最小化、最大化、关闭窗口
本例适用于IE
17.屏蔽功能键Shift,Alt,Ctrl
<script><br>function look(){ <br>if(event.shiftKey) <br>alert("禁止按Shift键!"); //可以换成ALT CTRL<br>} <br>document.onkeydown=look; <br></script>
18. 网页不会被缓存
或者
19.怎样让表单没有凹凸感?
或
20.
用来定义同一行内的元素,跟
21.让弹出窗口总是在最上面:
22.不要滚动条?
让竖条没有:
让横条没有:
两个都去掉?更简单了
24.电子邮件处理提交表单
25.在打开的子窗口刷新父窗口的代码里如何写?
window.opener.location.reload()
26.如何设定打开页面的大小
打开页面的位置
27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
28. 检查一段字符串是否全由数字组成
29. 获得一个窗口的大小
document.body.clientWidth; document.body.clientHeight
30. 怎么判断是否是字符
if (/[^/x00-/xff]/g.test(s)) alert("含有汉字");
else alert("全是字符");
31.TEXTAREA自适应文字行数的多少
32. 日期减去天数等于第二个日期
33. 选择了哪一个Radio
Style
Barcode
34.脚本永不出错
35.ENTER键可以让光标移到下一个输入框
36. 检测某个网站的链接速度:
把如下代码加入
37. 各种样式的光标
auto :标准光标
default :标准箭头
hand :手形光标
wait :等待光标
text :I形光标
vertical-text :水平I形光标
no-drop :不可拖动光标
not-allowed :无效光标
help :?帮助光标
all-scroll :三角方向标
move :移动标
crosshair :十字标
e-resize
n-resize
nw-resize
w-resize
s-resize
se-resize
sw-resize
38.页面进入和退出的特效
进入页面
推出页面
这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使用哪种特效,取值为1-23:
0 矩形缩小
1 矩形扩大
2 圆形缩小
3 圆形扩大
4 下到上刷新
5 上到下刷新
6 左到右刷新
7 右到左刷新
8 竖百叶窗
9 横百叶窗
10 错位横百叶窗
11 错位竖百叶窗
12 点扩散
13 左右到中间刷新
14 中间到左右刷新
15 中间到上下
16 上下到中间
17 右下到左上
18 右上到左下
19 左上到右下
20 左下到右上
21 横条
22 竖条
23 以上22种随机选择一种
39.在规定时间内跳转
40.网页是否被检索
其中属性值有以下一些:
属性值为"all": 文件将被检索,且页上链接可被查询;
属性值为"none": 文件不被检索,而且不查询页上的链接;
属性值为"index": 文件将被检索;
属性值为"follow": 查询页上的链接;
属性值为"noindex": 文件不检索,但可被查询链接;
属性值为"nofollow": 文件不被检索,但可查询页上的链接。
41、email地址的分割
把如下代码加入
webmaster@sina.com
42、流动边框效果的表格
把如下代码加入
<SCRIPT><br>l=Array(6,7,8,9,'a','b','b','c','d','e','f')<br>Nx=5;Ny=35<br>t="<table border=0 cellspacing=0 cellpadding=0 height=" ((Nx 2)*16) "><tr>"<br>for(x=Nx;x<Nx Ny;x )<BR>t ="<td width=16 id=a_mo" x "> </td>"<br>t ="</tr><tr><td width=10 id=a_mo" (Nx-1) "> </td><td colspan=" (Ny-2) " rowspan=" (Nx) "> </td><td width=16 id=a_mo" (Nx Ny) "></td></tr>"<br>for(x=2;x<=Nx;x )<br>t ="<tr><td width=16 id=a_mo" (Nx-x) "> </td><td width=16 id=a_mo" (Ny Nx x-1) "> </td></tr>"<br>t ="<tr>"<br>for(x=Ny;x>0;x--)<br>t ="<td width=16 id=a_mo" (x Nx*2 Ny-1) "> </td>"<br>***(t "</tr></table>")<br>var N=Nx*2 Ny*2<br>function f1(y){<br>for(i=0;i<N;i ){<BR>c=(i y) ;if(c>10)c=20-c<br>document.all["a_mo" (i)].bgColor=""""#0000" l[c] l[c] "'"}<br>y <br>setTimeout('f1(' y ')','1')}<br>f1(1)<br></SCRIPT>
43、JavaScript主页弹出窗口技巧
窗口中间弹出
<script><br>window.open("http://www.jb51.net","","width=400,height=240,top=" (screen.availHeight-240)/2 ",left=" (screen.availWidth-400)/2);<br></script>
============
==============
一、在下面的代码中,你只要单击打开一个窗口,即可链接到赛迪网。而当你想关闭时,只要单击一下即可关闭刚才打开的窗口。
代码如下:
二、上面的代码也太静了,为何不来点动感呢?如果能给页面来个降落效果那该多好啊!
代码如下:
<script> <br> function drop(n) { <br> if(self.moveBy){ <br> self.moveBy (0,-900); <br> for(i = n; i > 0; i--){ <br> self.moveBy(0,3); <br> } <br> for(j = 8; j > 0; j--){ <br> self.moveBy(0,j); <br> self.moveBy(j,0); <br> self.moveBy(0,-j); <br> self.moveBy(-j,0); <br> } <br> } <br> } <br> </script>
3. I hate that many websites always open in the default window. It would be great if you could control the opened window as you wish.
The code is as follows:
First frame | Second frame | Third frame |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Win11 Tips Sharing: One trick to skip Microsoft account login Windows 11 is the latest operating system launched by Microsoft, with a new design style and many practical functions. However, for some users, having to log in to their Microsoft account every time they boot up the system can be a bit annoying. If you are one of them, you might as well try the following tips, which will allow you to skip logging in with a Microsoft account and enter the desktop interface directly. First, we need to create a local account in the system to log in instead of a Microsoft account. The advantage of doing this is

In C language, it represents a pointer, which stores the address of other variables; & represents the address operator, which returns the memory address of a variable. Tips for using pointers include defining pointers, dereferencing pointers, and ensuring that pointers point to valid addresses; tips for using address operators & include obtaining variable addresses, and returning the address of the first element of the array when obtaining the address of an array element. A practical example demonstrating the use of pointer and address operators to reverse a string.

We often create and edit tables in excel, but as a novice who has just come into contact with the software, how to use excel to create tables is not as easy as it is for us. Below, we will conduct some drills on some steps of table creation that novices, that is, beginners, need to master. We hope it will be helpful to those in need. A sample form for beginners is shown below: Let’s see how to complete it! 1. There are two methods to create a new excel document. You can right-click the mouse on a blank location on the [Desktop] - [New] - [xls] file. You can also [Start]-[All Programs]-[Microsoft Office]-[Microsoft Excel 20**] 2. Double-click our new ex

VSCode (Visual Studio Code) is an open source code editor developed by Microsoft. It has powerful functions and rich plug-in support, making it one of the preferred tools for developers. This article will provide an introductory guide for beginners to help them quickly master the skills of using VSCode. In this article, we will introduce how to install VSCode, basic editing operations, shortcut keys, plug-in installation, etc., and provide readers with specific code examples. 1. Install VSCode first, we need

Win11 tricks revealed: How to bypass Microsoft account login Recently, Microsoft launched a new operating system Windows11, which has attracted widespread attention. Compared with previous versions, Windows 11 has made many new adjustments in terms of interface design and functional improvements, but it has also caused some controversy. The most eye-catching point is that it forces users to log in to the system with a Microsoft account. For some users, they may be more accustomed to logging in with a local account and are unwilling to bind their personal information to a Microsoft account.

Title: PHP Programming Tips: How to Jump to a Web Page within 3 Seconds In web development, we often encounter situations where we need to automatically jump to another page within a certain period of time. This article will introduce how to use PHP to implement programming techniques to jump to a page within 3 seconds, and provide specific code examples. First of all, the basic principle of page jump is realized through the Location field in the HTTP response header. By setting this field, the browser can automatically jump to the specified page. Below is a simple example demonstrating how to use P

Forms are an integral part of writing a website or application. Laravel, as a popular PHP framework, provides rich and powerful form classes, making form processing easier and more efficient. This article will introduce some tips on using Laravel form classes to help you improve development efficiency. The following explains in detail through specific code examples. Creating a form To create a form in Laravel, you first need to write the corresponding HTML form in the view. When working with forms, you can use Laravel

In Go language program development, function reconstruction skills are a very important part. By optimizing and refactoring functions, you can not only improve code quality and maintainability, but also improve program performance and readability. This article will delve into the function reconstruction techniques in the Go language, combined with specific code examples, to help readers better understand and apply these techniques. 1. Code example 1: Extract duplicate code fragments. In actual development, we often encounter reused code fragments. At this time, we can consider extracting the repeated code as an independent function to
