Javascript JSQL and SQL are everywhere,

Source: Internet
Author: User

You can also perform the following operations:
Copy codeThe Code is as follows:
Var Room = [
{
ID: 'bot ',
Name: 'test ',
Sex: true
},{
ID: 2,
Name: 'test8 ',
Sex: true
},{
ID: 3,
Name: 'test5 ',
Sex: false
},{
ID: 4,
Name: 'test2 ',
Sex: true
}];
"Update Room set name = 'man 'where sex = true". executeSQL ();

Supported SQL statements include SELECT \ INSERT \ UPDATE \ DELETE \ CREATE TABLE \ DROP TABLE
3. I found that DOM can also be operated using SQL.
For example, you can insert 100 image elements as follows:
Copy codeThe Code is as follows:
'Create table logolist'.fordom(cmd.exe cuteSQL ();
For (var I = 0; I <100; I ++ ){
"Insert into logolist (nodename, title, src) values ('img ', 'Google', 'images/google.gif ')" .fordom(cmd.exe cute ();
};

Then UPDATE the src attribute of the Image Element with UPDATE:
Copy codeThe Code is as follows: ("update logolist set src = '" + logo1 + "'" pai.fordom(cmd.exe cute ();
Or DELETE the following elements:
Copy codeThe Code is as follows: ("delete from logolist where title = 'Google '" pai.fordom(cmd.exe cute ();

Or act as selector:
Copy codeThe Code is as follows:
Var result = ("select * from logolist" cmd.fordom(cmd.exe cute ();
For (var I = 0; I <result. length; I ++ ){
Result [I]. src = 'baidu.gif ';
};

Related Article

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: info-contact@alibabacloud.com 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.