JavaWeb study notes (4)

You can know the contents of input by the input box label .value

getElementById get node id

getElementsByTagName obtain a plurality of nodes returned by an array tag name, there is an array of all the nodes

the getElementsByName () Gets a plurality of nodes returned by the name attribute is an array, the array of all nodes in the presence of

 When acquiring the label by firstChild / lastChild, you can not have spaces between each label or wrap

 

document.createElement create HTML tags

document.createTextNode create a text node

appendChild add a child node

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
    function myClick() {
        //1.创建li标签
        var szTag=document.createElement("li");
        // 2. Create a text node 
        var txtTag = document.createTextNode ( " Shenzhen " );
         // 3.li node add content 
        szTag.appendChild (txtTag);
         // 4. acquire the label urban 
        var cityTag = document.getElementById ( " City " ); 
        cityTag.appendChild (szTag); 
    } 
</ Script > 
</ head > 
< body > 
< UL ID =" City " > 
    < Li > Beijing </ Li >
    <li>上海</li>
    <li>广州</li>
</ul>
<button onclick="myClick()">点击!</button>
</body>
</html>

Database operations

create

create database mydb1;

Create database mydb2 character set gbk;

Create database mydb3 character set gbk COLLATE gbk_chinese_ci;

COLLATE: refers to the collation

                         

Inquire

View all current database server database

show databases;

Mydb2 definition information database created earlier view

Show  create  database mydb2;

Delete mydb3 database created earlier

Drop database mydb3;                       

modify

Check the server database and modify the mydb2 character set is utf8;

alter database mydb2 character set utf8;

delete       

drop database mydb3;                                              

other:

View current database used

select database();

Switching Database

use mydb2;

The current database of all the tables

SHOW TABLES;

View the table of field

DESC employee;

Add an image column.

ALTER TABLE employee ADD image blob;

Modifying the length of the column job 60

ALTER TABLE employee MODIFY job varchar(60);

Delete image column

ALTER TABLE employee DROP image; // You can only delete a row

Table name was changed to user.

RENAME TABLE employee TO user;

View the details of creating tables

SHOW CREATE TABLE user;

Changes to the table character set gbk

ALTER TABLE user CHARACTER SET gbk;

Column name name changed to username

ALTER TABLE user CHANGE name username varchar(100);

Delete table

DROP TABLE user ;

 

Guess you like

Origin www.cnblogs.com/zhangwugai/p/11197145.html