Web page javascript essence code set_basic knowledge
[1. Ordinary pop-up window]
works on some older browsers. In these old browsers, the code in the tag will not be displayed as text
Come out. You can use either single quotes or double quotes, just don't mix them.
【2. Pop-up window after setting】
Parameter explanation:
End of js script
【 3. Use functions to control pop-up windows]
The following is a complete code.
.....
A function openwin() is defined here, how to call it?
Method 1:
A window pops up when the browser reads the page;
Method 2:
A window pops up when the browser leaves the page;
Method 3: Call with a link: Method 4: Call with button:
[4. Pop up 2 windows at the same time]
Slightly change the source code:
To avoid pop-up The two windows are covered. Use top and left to control the pop-up position so that they do not cover each other. Finally, use the four methods mentioned above
to call it. Note: The names of the two windows (newwindows and newwindow2) should not be the same, or they should all be empty.
[5. The main window opens the file 1.htm, and the small window page.html pops up at the same time]
The following code is added to the main window
area:
Join the
area:
open
.
[6. Timing closing control of pop-up windows]
Now let’s control the pop-up windows, and the effect will be better. If we add a small piece of code to the pop-up page (
note that it is added to the HTML of page.html, not the main page, otherwise...), let it close automatically after 10 seconds, right? Cooler?
First, add the following code to the
area of the page.html file:
Then, use the sentence [7. In the pop-up Add a close button to the window]
[8. Pop-up window included - two windows on one page]
Through the following example, you can complete the above effect in one page.
>
Look at the code in OpenWindow.document.write(). Isn’t it standard HTML? Just write more lines according to the format
. Be sure to note that an error will occur if there is one more label or one less label. Remember to end it with OpenWindow.document.close().
[9. Cookie Control of Pop-up Window]
Recall that although the above pop-up window is cool, it has a little problem. For example, if you put the above script in a page that needs to be visited frequently (such as the homepage), then every time you refresh the page, the window will pop up. Isn't it very annoying? :-(
Solution:
We can use cookies to control it. First, add the following code to the
area of the main page HTML:
Then, replace the original sentence
in the main page with (note it is not openwin but loadpop!). You can try refreshing the page or re-entering it. Pages and windows will never pop up again. The real
Pop-Only-Once!
At this point, the production and application skills of pop-up windows are basically completed.
1.弹启一个全屏窗口
;
[url]www.e3i5.com[/url]
2.弹启一个被F11化后的窗口
;
[url]www.e3i5.com[/url]
3.弹启一个带有收藏链接工具栏的窗口
('http://www.pconline.com.cn','example03','width=400,height=300,directories');>
[url]www.e3i5.com[/url]
4.网页对话框
<script> <BR><!-- <BR>showModalDialog <br><br>('http://www.pconline.com.cn','example04','dialogWidth:400px;dialogHeight:300px; <BR>dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes') <BR>//--> <BR></script>
[url]www.e3i5.com[/url]
<script> <BR><!-- <BR>showModelessDialog <br><br>('http://www.pconline.com.cn','example05','dialogWidth:400px;dialogHeight:300px; <BR>dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes') <BR>//--> <BR></script>
target=_blank>[url]http://www.pconline.com.cn[/url]
showModalDialog()与showModelessDialog()的区别,在于showModalDialog()打开模式窗口,
showModelessDialog()打开无模式窗口。
dialogHeight: iHeight 设置对话框窗口的高度。
dialogWidth: iWidth 设置对话框窗口的宽度。
dialogLeft: iXPos 设置对话框窗口相对于桌面左上角的left位置。
dialogTop: iYPos 设置对话框窗口相对于桌面左上角的top位置。
center: {yes no 1 0 } 指定是否将对话框在桌面上居中,默认值是“yes”。
help: {yes no 1 0 } 指定对话框窗口中是否显示上下文敏感的帮助图标。默认值是“yes”。
resizable: {yes no 1 0 } 指定是否对话框窗口大小可变。默认值是“no”。
status: {yes no 1 0 } 指定对话框窗口是否显示状态栏。对于非模式对话框窗口,默认值是“yes”;
对于模式对话框窗口,默认值是 “no”。
网页经典代码
1. 将彻底屏蔽鼠标右键,无右键菜单
也可以用于网页中Table框架中
no |
2.取消选取、防止复制
3.不准粘贴
4.防止复制
5.IE地址栏前换成自己的图标
说明:关于favicon.ico文件的制作。你可以先在FW中做一个图片,属于你自己站点一个小图标。然后在
ACD see将文件属性改为*.ico,然后将你做的*.ICO文件传到你的服务器目录中,然后就可以使用以上代
码来实现,当别人登陆你的站点时,地址栏里使用的就是你自定义的图标了。
6.可以在收藏夹中显示出你的图标
说明:制作方法和上面的一样。只是显示的方式不同,这个是在别人收藏你的网页地址时显示的个性图
标。
7.关闭输入法
说明:这段代码是在表格提交时用到的。也就是在输入数据时不可以使用其他输入法模式。
8.永远都会带着框架
<script><!-- <BR> if (window == top)top.location.href = frames.htm;// --></script>
说明:frames.htm为你的网页,这也是保护页面的一种方法
9.防止被人frame
<script><!-- <BR> if (top.location != self.location)top.location=self.location; <BR>// --></script>
10.网页将不能被另存为
说明:
11.查源文件
onclick=window.location = 'view-source:'+ target=_blank>[url]http://bbs.055.cn/test.htm
[/url]';>
12.COOKIE脚本记录,有很大的用处哦
function get_cookie(Name) {
var search = Name + =
var returnvalue = ;
if (documents.cookie.length > 0) {
offset = documents.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = documents.cookie.indexOf(;, offset);
// set index of end of cookie value
if (end == -1)
end = documents.cookie.length;
returnvalue=unescape(documents.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')==''){
openpopup()
documents.cookie=popped=yes
}
}
说明:以上是JS代码,请自己加起始符和结束符
13.内框架

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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

Frequently Asked Questions and Solutions for Front-end Thermal Paper Ticket Printing In Front-end Development, Ticket Printing is a common requirement. However, many developers are implementing...

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.

There is no absolute salary for Python and JavaScript developers, depending on skills and industry needs. 1. Python may be paid more in data science and machine learning. 2. JavaScript has great demand in front-end and full-stack development, and its salary is also considerable. 3. Influencing factors include experience, geographical location, company size and specific skills.

Learning JavaScript is not difficult, but it is challenging. 1) Understand basic concepts such as variables, data types, functions, etc. 2) Master asynchronous programming and implement it through event loops. 3) Use DOM operations and Promise to handle asynchronous requests. 4) Avoid common mistakes and use debugging techniques. 5) Optimize performance and follow best practices.

How to merge array elements with the same ID into one object in JavaScript? When processing data, we often encounter the need to have the same ID...

Discussion on the realization of parallax scrolling and element animation effects in this article will explore how to achieve similar to Shiseido official website (https://www.shiseido.co.jp/sb/wonderland/)...

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

In-depth discussion of the root causes of the difference in console.log output. This article will analyze the differences in the output results of console.log function in a piece of code and explain the reasons behind it. �...
