Home > Web Front-end > JS Tutorial > Javascript JSQL, SQL everywhere, _javascript tips

Javascript JSQL, SQL everywhere, _javascript tips

WBOY
Release: 2016-05-16 18:28:16
Original
1042 people have browsed it

In fact, you can also do this:

Copy code The 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 The statements include SELECT INSERT UPDATE DELETE CREATE TABLE DROP TABLE
3. As mentioned last time, I found that DOM can actually be operated with SQL
For example, you can directly insert 100 image elements as follows:
Copy code The code is as follows:

'create table logolist'.ForDOM().executeSQL();
for (var i=0;i<100;i ) {
"insert into logolist(nodename,title,src) values ​​('img','google','images/google.gif')".ForDOM() .execute();
};

Then use UPDATE to update the src attribute of the image element:
Copy code The code is as follows:
("update logolist set src='" logo1 "'").ForDOM().execute();

or DELETE these that meet the conditions Element:
Copy code The code is as follows:
("delete from logolist where title='google'") .ForDOM().execute();


Or act as a selector:
Copy code The code is as follows:

var result = ("select * from logolist").ForDOM().execute();
for(var i=0;iresult[i].src = 'baidu.gif';
};
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template