This week I learned the syntax basis of 3 parts of the client, xhtml, css and javascript. First: About xhtml attributes (tags)— 1. Form properties <form action="form handler url" method="gei/post"> 2.<id="" name="">These two attributes are the unique identification numbers and differences of form life. According to my personal homework and usage this week, most of them are used in controls such as <form> <input> in. 3. Control properties <input>, <select> and <option>, <textarea>; <input> is a control that is different from the type attribute definition. There are 10 types, including text boxes, multiple choices, single choices, password boxes, submissions and cancels, etc. Used for different controls according to different needs. <select> and <option> are used together as control drop-down menus. Basic format: <select name="" id=""> <option value="">xx</option> </select> <textarea> is used to create a multi-line text box. 4. Commonly used definition attributes: font-family: define the font style of the entire page; font-size: font size; width: width; height: height; colspan:"" number of columns; align: position; <br />Empty line&nbps ;One space Second: css control page 1. Style rules: In the layout using css style, the basic format is as follows Selector{ Attribute 1: Value 1; Attribute 2: Value 2; ..... } And add <style type="text/css"> to <head></head> to call css-related functions 2. Selector: element selector, class selector, id selector, containing selector, wild selector, pseudo-class and pseudo-element selector. (Please refer to Book 54-56) 3. Style rule position: There are 3 forms in total - outreach, inline and embedded. Outreach is to create a .css file in the same file as the generated page file, and then write the working attribute code in the form of text in .css. And in the page file, use <link rel="stylesheet" type="text/css" ref="url of stylesheet"> To call, this method is suitable for multiple pages to use the same style. Embed is the commonly used css attribute, that is, add <style type="text/css"> to <head></head>, and use Selector{ Attribute 1: Value 1; Attribute 2: Value 2; ..... } This form is used. Inline means using the style attribute after the element to mark the style when it is displayed. Basically most html tags have style attributes. 4.CSS box mold and overlap (1) margin: margin border: border padding: border spacing (see Book 53 for details) (2) CSS attribute unit: (see detailed introduction on pages 57-65 of the book) (3) div-css page layout: This is the point, not only the <table> attribute can layout the entire page, but the commonly used <div> is more convenient and concise. Third: The syntax basis and advancement of javascript There are only 3 points to master: 1.<script type="text/javascript"> This is the same as calling the css attribute. document.write("Hello") is equivalent to the meaning of c language printf, and can also be replaced by alert. 2. Event handler: There are 4 knowledge points in this point, which are quite a lot. Please refer to the detailed introduction on pages 81-95 on the tree. 3. Advanced syntax: that is, select a class similar to the data type, loop, order, and selection in C language. There are just a few differences: (1) Define the data type without explicit definition, just use var. (2) Different types of data calculations are not as clear as C language. For example, var 'a' b, a character type and a data nature, c='a'-b can also be calculated. (3) Added string operator. 4. Function call: This is also similar to C language. I will use an example to illustrate: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" " http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd "> </body> This question is summed using function calls, and everyone should be able to understand - -! Our homework. OK, this is my summary this week. I hope it will be helpful to everyone. It will definitely not be comprehensive and used as a reference only!
<html xmlns=" http://www.w3.org/1999/xhtml " xml:lang="en" lang="en">
<head>
<title>javascript sum</title>
<script type="text/javascript">
function sum1(m){
var i ,n=1;
for(i=1;i<=m;i++){
n=1/i*n;
}
return n;
}
function sum(n){
var i,s=0;
for(i=1;i<=n;i++){
s=s+sum1(i);
}
alert(s);
}
</script>
</head>
<body>
<form action="#" method="get">
1+1/2!+1/3!+1/4!......1/10!=
<input type="button" value="sum" onclick="sum(10);" />
</form>
</html>