PHP job book series-PHP Web programming, job Book web

Source: Internet
Author: User
Tags set background

PHP job book series-PHP Web programming, job Book web

PHP Web Programming


1. What is the maximum transfer capacity of POST and GET?


  • The form data submitted by the GET method is appended to the URL and sent to the server as part of the URL.The URL length must be less than 1 MB..
  • The POST method does not depend on the URL and does not display the passed parameter values in the address bar. In addition,The POST method can transmit data to the server without any restrictions.All submitted information is transmitted in the background, which is invisible to the user on the browser side and highly secure.

 2. How to control the size of the uploaded file through form?

  • Enctype = "multipart/form-data", which specifies the form encoding method.
  • Method = "post", specifies the data transmission mode.
  • <Input type = "hidden" name = "MAX_FILE_SIZE" value = "10000"/>: controls the size of uploaded files by hiding Fields(In bytes). The value cannot exceed the value set by the upload_max_filesize option in the php. ini configuration file.

  3. How to set the read-only attribute in the form?

  • ExploitationReadonlySets the read-only attribute of the specified content;
  • ExploitationDisabledSets the read-only attribute of the specified content.

 4. Under what circumstances can $ name and $ _ POST ['name'] Be used universally?

  When register_globals is On in the php. ini file,Both $ name and $ _ POST ['name'] can obtain the value of the form element name in the form (submitted in post mode ).

However, it is not recommended to enable all register_globals variables because it brings security risks to the program.

CSS style

1. What does CSS mean?

  CSS (Cascading Style Sheet, translated"Stacked Style Sheets"Or" Cascading Style Sheet ") is a markup language that can be directly interpreted and executed by a browser (a browser interpreted language) to control the appearance of a Web page. It is a set of extended style standards specified by W3C to make up for insufficient HTML display attribute settings.

Its functions are as follows:

  • In the standard webpage design, CSS is responsible for the performance of the webpage content (XHTML.
  • A cssfile can also be said to be a development file, which contains some CSS tags. the CSS file suffix uses .css as the suffix.
  • The separation of content and forms through CSS files can change the overall form of the webpage, making it easier to maintain the site appearance, making the HTML document code more concise, and shortening the loading time of the browser.

2. How many CSS styles can be inserted into an HTML page?

  • Define a pair of <style> </style> tags on the Inside the tag, you can use the tag name, class identifier, and id Identifier to set attributes.
  • Define the style attribute inside the tagAnd then define the style under the label, such:

<A href = "#">Create a. CSS style FileIn the file, use the id or class separator to define the style, and then on the displayed HTNL HomepageUse the <link> label to introduce a file. For example:

  <Link type = "text/css" rel = "stylesheet" href = "path">

3. common attributes of CSS styles:

Common attributes of CSS styles
Attribute name Analysis
Border You can define border attributes to set Border width, color, and style.
Background-color Set background color
Background-image Set background image
Font-size Set Font Size
Font-family Set Font
Text-decoration Retrieves or sets the decoration of text in an object, such as underline and blinking.
Line-height Retrieves or sets the Row Height of an object, that is, the distance between the bottom of the font and the top of the font.
Letter-spacing Retrieves or sets the interval between texts in an object.
Text-align Sets or retrieves the text alignment of an object.










  4. How to Solve the double margin problem of the following code under IE6?

<style type="text/css">body {margin:0;}div  {float:left;  margin-left:10px;    width:200px;    height:200px;  border:1px;    solid red;}</style>

This is a common Bug in IE6. Although the defined margin is 10px, IE is parsed to 20px.

Solution:Add property display: inline

  5. How can I solve the problem that the hover style does not appear after the hyperlink is clicked?

  Sort the hyperlink style attributes correctly.

  A: link {color: red; text-docoration: none}

  A: visited {color: blue; text-decoration: none}

  A: hover {color: black; text-decoration: overline}

  A: action {color: black; text-decoration: overline}

6. How can I solve the problem that text in Firefox cannot open containers?

Add two CSS attributes,Min-widthAndMin-heightYou can also add a class clear: both attribute div to clear alignment to automatically calculate the height of Firefox.

  7. How to define a container with a height of around 1 px?

In the process of webpage layout, a partition is usually required between the navigation bar and the content bar. Generally, the height of one pixel is the best.

DIV tag

 1. The difference between the tag <span> and <div>:

The <div> and <span> tags also apply to the webpage layout. Their differences are as follows:

  • The span tag is inline and is generally used for inline styles of small modules into HTML documents.
  • The div element itself is a block-level element. It is mostly used to combine large pieces of code.

  2. How to center a DIV layer?

  Position: absolute;

  Top: 50%;

 Left: 50%;

 Margin:-100px 0 0-100px;

  3. How to solve the problem that the text-align attribute of the nested div label in the filefox browser is invalid?

1 <style>2 .one {border:1px solid blue;width:300px;height:200px;text-align:center }3 .two {border:1 px solid blue;width:200px;height:100px;margin:0px auto }4 </style>5 <div class="one">6 <div class="two"></div>7 </div>

  JavaScript script

  1. Functions in the pop-up dialog box and input focus functions:

Dialog BoxAlert ()Function

Get input focus usageFocus ()Function

  2. What are the conversion functions of JavaScript? How to introduce an external JavaScript file?

Steering function:Window. location. href = "file name ";

Introduce external JavaScript files:<Script type = "text/javascript src = 'file path and name'"> </script>

3. When you hover the mouse over the text box, the content in the text box is automatically selected:

<Input id = "txt" type = "text" value = "baidu" onmouseover = "this. select ()"/>


<Input id = "txt" type = "text" value = "baidu" onclick = "this. value ='' "/>

5. Set the JavaScript code for the Home Page:

<A href = "#" onclick = "this. style. behavior = 'url (# default # homepage) '; this. setHomepage ('url'); "> set as homepage </a>


Ajax applications

  1. Use Ajax in jQuery to determine whether the user name is occupied:

You need to define two pages. The index. php Page code is as follows:

1 <script type = "text/javascript" src = "jquery-1.4.2.js"> </script> 2 <input type = "text"> <input type = "button" value = "Check "> 3 <script type =" text/javascript "> 4 $ (function () {5 $ ("input: last ". click (function () {6 $. get ("in. php ", {7 username: $ (" input: first "). val () 8}, function (data) {9 alert (data); 10}) '11}); 12}); 13 </script>

The in. php Page code is as follows:

1 <? Php 2 $ string = ""; 3 if (isset ($ GET [username]) {4 if (urldecode ($ GET [username]) = $ string) {5 echo "username occupied"; 6} else {7 echo "username available"; 8} 9} 10?>

2. Write the code so that you can enter a year in the text box, judge the Zodiac, and output it next to the text box. You need to write HTML and JavaScript code:

The front-end page design code is as follows:

1 PHP script for judging the Zodiac in the background:

1 <? Php2 if (isset ($ _ GET [number]) {3 $ array = array ("pig", "rat", "Ox", "Tiger", "rabbit ", "Dragon", "snake", "horse", "goat", "monkey", "chicken", "dog "); 4 foreach ($ array as $ key =>$ value) {5 if (ceil ($ _ GET [number] % 12) =key key) {6 echo $ value; 7} 8} 9}

JQuery framework

Currently, jQuery is a popular Client Scripting framework created by John Resig, an excellent JavaScript framework. Its purpose is to write less and do more. it is a lightweight js library, compatible with CSS3, and compatible with various browsers (IE 6.0 + ). Users can easily process HTML document and events, achieve animation effects, and provide AJAX interaction for websites. Another major advantage of jQuery is its comprehensive documentation and detailed descriptions of various applications. There are also many mature plug-ins to choose from. JQuery can ensure the separation of code and HTML content for your HTML pages. That is to say, you don't need to insert a bunch of JavaScript code into the HTML to call the command. You just need to define the id.

  1. Commonly Used selectors in jQuery:

  Basic selector:

Id selector: can be used only once

Class selector: Allows repeated use

Tag Selector

*: Matches all elements.

  Level selector:

$ ("# A. B") select all elements whose class value is B in the element whose id value is.

$ ("# A>. B") Select the child element whose class value is B after the element whose id value is.

$ ("# A +. B") Select an element whose id is a and the next class value is B.

  Filter selector:

: First, select the first element.

: Odd. Select an element with an odd index.

: Even. Select the element whose index is an even number.

: Not. Select other elements except an element.

: Eq (), search for elements by index.

: Lt (), an element smaller than a certain index value.

: Gt, an element greater than an index value.

  2. How to Find the elements in the DOM tree?

  Var input = $ ("input: first ");

 3. How to create and insert elements in the DOM tree?

1 <script type = "text/javascript" src = "jquery-1.4.2.js"> </script> 2 <div> fruit </div> 3 <script> 4 var title = $ (" <span> Apple </span> "); 5 $ ("div "). append (title); // append the title to the next 6 $ ("div") of the div TAG content "). before (title); // before appending the title to the div tag, it belongs to the same level as the div tag. 7 $ ("div "). prepend (title); // Add the title to the content before the div tag 8 $ ("div "). after (title); // append the title to the div tag and the div tag belongs to the same level 9 </script>

  4. How to replace the specified Element in the DOM tree?


1 <script type = "text/javascript" src = "jquery-1.4.2.js" </script> 2 <div> fruit </div> 3 <script> 4 var title = $ ("< span> Apple </span> "); 5 $ ("div "). replaceWith (title); 6 </script>


5. disappear the fade-out effect of an image on the page:


1 <script type="text/javascript" src="jquery-1.4.2.js"></script>2 3 <script>4 $("img".click(function(){5     $(this).fadeOut("slow");6 });7 </script>


6. Create a button. When the button is clicked, the shutter effect disappears:


1 <script type = "text/javascript" src = "jquery-1.4.2.js"> </script> 2 <input type = "button" value = "button"> 3 $ ("input" ). click (d = function () {4 $ (this ). slideUp ("slow"); 5}); 6 </script>


7. Photo rotation effect:





 1 <script type="text/javascript" src="jquery-1.4.2.js"></script> 2 <style> 3 ul{list-style:none;width:350px;height:200px;position:absolute} 4 li{position:ansolute} 5 </style> 6 <div class="change"> 7 <ul> 8 <li></li> 9 <li></li>10 <li></li>11 <li></li>12 </ul>13 </div>14 <script>15 $(function(){16     $(."change ul li:not(:first)").hide();17     setInterval(function(){18         if($."change ul li:last").is(":visible")){19             $(."change ul li:first").fadeIn("slow");20             $(."change ul li:last").hide();21     }else{22             $(."change ul li:visible").next().fadeIn("slow");23     }24   },1000);25 });26 </script>   




  In view of the recent preparations for various final exams and assignments, the posting time is significantly reduced, so I have to work hard to understand it! This article was edited in a fraction of the time. Now the success is quite satisfactory. If you think it is helpful, you can give a thumbs up.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.