PHP basic study notes (6), PHP basic study notes_PHP tutorial
php basic study notes (6), php basic study notes
window object
The window object is the "window object", that is, any open web page must be "loaded" into a window object. The window object represents the window. Learning the window object is actually nothing more than learning several methods provided by the window (similar to learning the event object is nothing more than learning to use several attributes of the event object)
window Several methods for popping up dialog boxes:
<span>1</span><span>. window.alert(“这里是文字信息”); </span><span>//</span><span>可以认为只是一个文字性提示信息。</span> <span>2</span>. <span>var</span> v1 =<span> window.prompt(“文字提示”,“默认信息”) </span><span>//</span><span>弹出一个供用户输入文字信息的对话框。通常用于向用户提出一个需要文字来回答的问题。其会返回一个“字符串值”</span> <span>3</span>. <span>var</span> v2 =<span> window.confirm(“一个是否性的问题”); </span><span>//</span><span>弹出一个向用户询问“真假”的问题,用户可以回答“真假”。通常用于向用户提出一个需要进行“是/否”性回答的问题。其会返回一个布尔值(true/false)。</span>
windowObject pop-up window method:
window.open();——You can pop up a "small" window, and you can "place" a web page in this window.
The grammatical form is as follows:
window.open(“The web page address url to be opened”, “Name given to the new window by yourself”, “Appearance parameter setting para of the new window”);
URL: It can be a relative address or an absolute address.
name: Custom name, just follow the naming rules, such as n1, win1, s1
Para: This setting has several items, separated by commas. The format of each item is: item name = value. Examples are as follows:
width=<span>400</span><span>, height</span>=<span>300</span><span>, left</span>=<span>500</span>, <span>//</span><span>表示离屏幕的左边的距离</span> top=<span>300</span>, <span>//</span><span>表示离屏幕的顶部的距离</span> menubar = yes; <span>//</span><span>表示打开的窗口具有菜单栏(no就没有),也可以使用1,0</span> toolbar = yes; <span>//</span><span>表示打开的窗口具有工具栏(no就没有),也可以使用1,0</span> location = yes; <span>//</span><span>表示打开的窗口没有地址栏(no就没有),也可以使用1,0(实际现代浏览器对此已经失效了,变成location必须显示)</span> scrollbars=yes; <span>//</span><span>表示打开的窗口具有滚动条。</span> <span> …………. 查《Dhtml完全手册》 综合举例: window.open(“ http:</span><span>//</span><span>www.baidu.com” , “db”, “width=400, height=300, left=500,top=300, menubar=yes, toolbar=1” ) </span> <span> 《DHTML完全手册》介绍。 DHTML就是“动态html”(Dynamic HTML) </span>
Timer method of window object:
Timer: refers to letting the browser automatically do certain things at certain intervals!
Grammar form:
var t1 = window.setInterval("code s to be executed", interval t); //This is called "creating a timer", the name is: t1
Explanation: Every set time t, the code s in quotation marks will be executed. The unit of t is "milliseconds". Here, the code to be executed usually uses a function call statement, and what really needs to be done is to complete it in the function.
Once a timer is created, it will automatically "allow others" to allow it, and it will either "live" or "die"
Comprehensive methods to find web page partners
document.getElementById(“id名”); <span>//</span><span>id属性所有标签都可以使用</span> <span> 通过id找到一个标签对象。 document.getElementsByName(“name名”); </span><span>//</span><span>name属性通常只用于表单上。</span> <span> 通过name找到若干个标签对象——也就是集合。这里集合其实就是相当于一个数组中放了若干个对象。集合的用法跟数组完全一样。注意,即使找出的结果中只有一个对象,也是集合,也要象数组一样使用。 document.getElementsByTagName(“标签名”); 通过标签名获取到网页中所有的该标签对象——也是集合,用法同上。 getElementsByTagName的另一个更实用用法是: obj. getElementsByTagName(“标签名”); </span><span>//</span><span>obj为某个小一点的标签对象。</span> <span> 在obj这个标签中获取若干个指定标签名的对象——更实用。 document.body:——直接就代表网页中的body这个特定标签对象。 document.documentElement:——直接就代表网页中的html这个特定的标签对象。 document.images:——代表网页中的所有img标签对象,也是一个集合,用法同上述集合。其实其也相当于:document.getElementsByTagName(“img”); document.links:——代表网页中所有a链接标签对象,也是一个集合。 document.anchors:——代表网页中的所有a锚点标签对象,也是一个集合 document.forms:——代表网页中的所有form表单对象,也是一个集合。 </span><span>event</span>.target / <span>event</span><span>.srcElement:——代表事件源——事件源就是对象 </span><span>this</span><span>:——代表事件源 ——意思是,象window对象,event对象,document对象是不需要“找”,而是直接使用。</span>
Timer method of window object
Use of recurring timer: The browser will execute the code (function) repeatedly at specified time intervals.
var t1 = window.setInterval("function()", interval); //Create a recurring timer and name it "t1"
window.clearInterval(t1) //Clear (stop/destroy) the recurring timer
——Alarm clock principle
Use of one-time timer: The browser will execute the code (function) once after the specified time.
var t2 = window.setTimeout("function()", interval); //Create a one-time timer and name it "t2"
window.clearTimeout(t2); //Clear (stop/destroy) the one-time timer
——Timing* principle
——One-time timer is usually used for some kind of code that only needs to be executed once
Inline frame (window)
Compare the frame window: The frame window divides the "current large window" into several small windows, and puts a web page in each window.
<frameset rows=”<span>150</span>, *”> <frame src=”page1.html” ></frame> <frame src=”page2.html” ></frame> </frameset>
Inline window: It is to "dig out" an area in the "current web page" as a small window, and this window can place other web pages.
Here, the "digging" area is actually the box concept in our HTML/CSS - a rectangular area.
The tag of the embedded window is: iframe, use as follows:
& lt; iframe src = "web address url" & gt; & lt;/iframe & gt;
iframe is very similar to the textarea tag in appearance, but its usage is completely different.
iframe is very similar to the textarea tag in appearance, but its usage is completely different.
Introduce external js files
NOTE: The suffix of the js file is js. Moreover, there can be no more js code in the middle of the above script tag.
Principle of making progress bar
It is nothing more than two boxes. The width of the outer box is fixed (such as 100), and the width of the inner box changes with the change of a data - here is the current number of stars.

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

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
