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.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment