Home > Article > Backend Development > JavaScript Programming: Basic PHPXML
This article is a high-quality first recommendation in the computer category>>>>"JavaScript Programming: Basics·PHP·XML"
Content introduction
"Huazhang Programmer" Book Library·JavaScript Programming: Basic PHP XML" starts with the basic knowledge of computers, covering basic knowledge of programming, basic knowledge of JavaScript, JavaScript loop structures, selection structures, forms, functions and source files, arrays, search and sorting, File Object Model and XML, PHP overview and related knowledge. "Huazhang Programmer's Library·JavaScript Programming: Basics"
"PHP XML" fully considers the needs of beginners, and the content is easy to understand. Corresponding cases, exercises and practical projects are arranged after each chapter. JavaScript is a powerful programming language on the Web, used to develop interactive web pages. Not only can it be applied directly to HTML documents to obtain interactive effects or other dynamic effects, but it can also be run on the server side to replace traditional CGI programs. In addition, JavaScript complies with the ECMAScript language standard and supports a variety of programming styles.
This book is a textbook for entry-level web programmers. The content in the book goes from shallow to deep, covering not only the basic programming techniques of JavaScript, but also the collaborative programming methods of JavaScript, XML, PHP, and MySQL. Compared with similar domestic books, this book has the following characteristics:
1) The writing style is delicate and step-by-step. This book explains in detail the basic concepts of programming (such as variables, selection statements, loop statements, etc.), and has detailed comments and explanations for almost every example program and code, making this book suitable for those who have never or have little knowledge of programming. Students with programming experience. 2) Rich examples and consistent throughout. This book is equipped with corresponding examples for almost every new knowledge point, and two complete cases (a game website and a teaching website) run through the text and exercises of each chapter of the book, thereby enhancing the fun and practicality
. 3) Based on the basics and taking into account the overall situation. This book mainly explains Web client programming technology based on JavaScript. In addition, it also briefly introduces Web server-side development technologies PHP and MySQL, so that students can use JavaScript naturally and understand the interactivity with server-side technology. This book can be used as a teaching material for JavaScript programming, Web programming, and dynamic web page production courses in colleges and universities, as well as in various majors at junior colleges.
Due to the limited level of the translator, omissions and errors in the translation are inevitable. We sincerely invite readers to criticize and correct us. Translator Welcome to this book. The author's motivation for writing this book is to provide appropriate learning materials for the "Internet Programming I" course in the two-year "Internet Service Programming" learning process. After completing two years of web development courses, students must become familiar with client-side and server-side scripting languages. While there are many good books on static web development techniques (HTML, XHTML, HTML5, and CSS), those covering JavaScript are either too tedious or well beyond a two-year study plan. This book is therefore designed to meet the needs of entry-level programmers who feel comfortable using JavaScript and understand its interoperability with server-side technologies. . Chapter 6 Most students who have taken web page production courses have already dealt with forms, but the purpose of this chapter is to familiarize students with using JavaScript to process forms. Since web page production courses have already discussed basic form controls (radio buttons, check boxes, text boxes, text area boxes, select lists) as well as hidden fields and special controls (password elements, submit and reset buttons), this chapter looks at For returning form data to a JavaScript program, the program can then use the data and return other information to the web page or send the information to the user via email. Students will create an inventory page for users of Greg's Gambits website and generate a progress report for Carla on Carla's Classroom website that will be sent to the student's parents.
Copyright statement: This article is an original article by the blogger and has not been published by the blogger. No reproduction allowed.
The above introduces JavaScript programming: basic PHPXML, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.
at Sun Yat-sen University
Part of the preface
This book can be used in a one-semester "JavaScript Programming" course for students who already know HTML and CSS. The programming basics part of this book emphasizes the application of programming concepts to JavaScript and PHP, and is suitable for students who have never or have little programming experience. Each concept is provided with a short example to help readers deepen their understanding of the concept, followed by a longer example for a real-world setting.
Two case studies are used throughout the book: a gaming website and a teaching website. Each chapter has a section that adds content and functionality to the two case studies, and students can add content in the programming challenges at the end of each chapter. Two other websites (one for a gardening company and another for a jewelry company) can also be built from scratch, and students can enhance their functionality in programming challenges. Teachers can adapt these as required.
This book assumes that students have learned HTML and CSS and are good at creating static web pages. However, students are not required to have programming experience, nor are they required to have special knowledge of mathematics, finance, or other subjects. When the final chapter uses SQL commands, there is no requirement that students have previous experience with SQL or databases.
Organization of this book
This book starts with Chapter 0 Computer Basics, and then Chapter 1 focuses on the general concepts of getting started with JavaScript programming. Chapter 1 introduces the case studies used throughout the book, but the case studies in each chapter of this book are independent of each other and can be used independently. Chapter 2 introduces variables, operators, and data types. These chapters are very important for students who have never taken a programming course and are familiar with programming concepts. Understanding the interactivity between web pages and JavaScript code is one of the most basic and important features of JavaScript.
Chapter 3 to 5 learn the basic control structures of JavaScript, namely sequence, selection and repetition. Students with no programming experience will learn how these statement structures work in general and in JavaScript in particular. Students with programming experience can quickly read these chapters.
Chapter 6 and 7 are exclusive to JavaScript and contain forms, functions, and external JavaScript files. Since most students have already used forms in static web pages, forms will be discussed here by connecting them to JavaScript programs.
Chapters 8 and 9 cover arrays and several advanced search and sorting techniques. These two chapters, along with the following three chapters, are best suited for students with a solid programming foundation.
Chapter 10 discusses the Document Object Model and introduces XML, and Chapters 11 and 12 introduce PHP. After completing these three chapters, students will be able to develop websites that use databases to process data. Students can use the free program XAMPP to set up an Apache server with MySQL and PHP software on their computer. This book will introduce the operation method of this software in detail. No knowledge of MySQL or databases is required. Students can use the given MySQL commands to set up a practical environment using databases, servers and PHP to create a dynamic website.
There are many examples in each chapter. Throughout, examples, checkpoints, and exercises increase in difficulty from the most basic conceptual understanding to very challenging practical applications. Each chapter includes a hands-on section where we developed the case study websites Greg's Gambits and Carla's Classroom. In the programming challenge section at the end of each chapter, students are asked to supplement these case studies. If you work from the beginning to the end of this book, you will develop a robust website from these case studies. The programming challenge also contains two additional case studies, Lee's
Landscape and Jackie's Jewelry websites, students will build these two websites entirely on their own. The book provides a lot of help in the programming challenge section for Greg's Gambits and Carla's Classroom projects, but only a little help for Lee's Landscape and Jackie's Jewelry projects. Teachers can determine how independently students can complete these projects.
The exercise part includes fill-in-the-blank questions, true-false questions and short-answer questions, while in the programming challenge part, students can create their own web pages using the knowledge learned in the corresponding chapters.
Introduction to each chapter
Format description
This book uses different fonts to distinguish program code, and variable and array names are bold. Sometimes certain codes must be entered on a single line, but due to paper size it is impossible to display these codes completely on one line, so symbols are used to indicate that the next line of code should be part of the previous line, and this symbol should not be included.Without symbols, the following sample code should be entered on the same line. Note that the variable dinner is in bold:
Chapter 1 This chapter introduces programming and JavaScript, discusses general problem-solving strategies for programming, the basic structure of programs and three types of control structures, and discusses planning with pseudocode and flow charts Programs and data types, guide students to create JavaScript scripts in web pages, discuss objects, point markers, and several important JavaScript methods and events, introduce Greg's Gambits and Carla's Classroom websites, and use JavaScript to create interactive pages for these websites.
Chapter 2 This chapter looks at variables, JavaScript data types, and operators (including arithmetic, relational, and logical operators), explains the difference between weakly typed languages and strongly typed languages like JavaScript, and discusses the use of connection operators and JavaScript Handles user input of numbers, discusses conditional operators so students can create interesting pages without using selection structures, discusses operator precedence and ASCII codes. Students will create crossword puzzles for Greg's Gambits website and Carla's
Create spelling lessons on the Classroom website.
Chapter 3 This chapter discusses the judgment (selection) structure (including single-way, two-way and multi-way branch structures). Introduce switch statements, verification methods and Math objects, and develop programs using nested selection structures and compound conditions. Students can create interesting programs using the Math.random() method, create a fortune teller program for Greg's Gambits and create an arithmetic lesson for Carla's Classroom.
Chapter 4 This chapter starts with repeating structures and looks at basic loop structures: pretest, posttest loops, sentinel control loops, counter control loops, and loops for data entry and data validation. Loop statements include while loops, do...while loops and for loops. Students will create a message encoder for Greg's Gambits and add a lot of functionality and depth to the Carla's Classroom arithmetic lesson created in Chapter 3.
This chapter further explores the repetition structure and selection structure involved in Chapters 3 and 4, introduces the calculation methods of totals and averages by using some methods of the Math object, and discusses in depth nested structures (including loops) selection structures, loops within loops, and loops within selection structures) as well as benchtop checks. Introduce various methods of exiting the loop early. Students will create a fighting game for Greg's Gambits (a variation of the game Rock-Paper-Scissors) and a grammar lesson for Carla's Classroom.
This chapter contains functions, objects, and JavaScript source files. It discusses built-in and custom functions, including variable scope, using actual and formal parameters, value parameters and reference parameters, pass by reference and pass by value, and introduces new Objects (Boolean and Date) and provides more information on Math objects, introducing creating and using external JavaScript source files. Students will create a Hanging Man charade for Greg's Gambits and a reading comprehension lesson for Carla's Classroom.
Chapter 8 This chapter is one of two chapters that focuses on arrays. It discusses the concept of arrays as JavaScript objects (including one-dimensional arrays, two-dimensional arrays, and parallel arrays), discusses different methods of loading arrays, and several additions and deletions. JavaScript array methods for array elements. Students are to create a number puzzle 15 for Greg's Gambits and a slide show for Carla's Classroom.
Chapter 9 This chapter is based on Chapter 8, explaining sorting and searching arrays, and discussing JavaScript's sort() and reverse() methods. In order to maintain the integrity of parallel arrays, other search and sort methods were developed, including two sorting algorithms (bubble sort and selection sort), two search algorithms (linear search and binary search), and some JavaScript methods to implement searches. Students will create a Scrabble puzzle for Greg's Gambits and a factoring lesson for Carla's Classroom.
This chapter moves from JavaScript to related topics, discussing Document Object Model (DOM) and XML, discussing the concepts of DOM nodes and trees and the parent-child model of web pages, discussing using DOM technology to create, insert, delete and replace elements and using DOM Method to create a timer. This chapter also introduces XML, XSL, namespaces, and schemas. Using XML and JavaScript together is another alternative way to display data when creating pages for Greg's Gambits. Use XML and JavaScript together to create spelling lessons for Carla's Classroom.
Chapter 11 This is one of two chapters related to PHP. To use PHP, students must have access to the server. This chapter introduces students to the installation and use of XAMPP, a free program that includes the Apache server, PHP, and MySQL and can be installed on any personal computer or laptop. This chapter discusses the basic knowledge of PHP, including PHP file names, how to access files on the Apache server, PHP data types, PHP operators and PHP keywords, and introduces the basic program structure of PHP (including order, selection and repetition) and PHP arrays and strings. , emphasizes creating a proper folder structure for the website on the server. Students will use PHP to create a welcome page for Greg's Gambits and allow users to send and return data to the server by using the ajax_post() function. Students also use PHP for Carla's
Classroom creates a page that lets the user enter part of a name and then the program displays all entries in a large array or list starting with those characters (i.e., the program provides the user with available options and can ultimately be used to automate user entry).
Chapter 12 This chapter builds on the introduction of PHP in Chapter 11 and demonstrates how to complete two special and important tasks, discusses creating and reading cookies, and guides students to use the phpMyAdmin console to create a database (it is part of the XAMPP installation). Then, use PHP methods to populate the database. Because this book does not include the study of MySQL and does not require students to have knowledge of database management and MySQL, this chapter gives all the MySQL commands and statements needed to develop programs and explains them. This will allow students to create and verify accounts for players who want to become members of the Greg's Gambits gaming site. Students will also create a database for Carla's Classroom and extract information from the database to send an email report to the student's parents.