Javascript jsql,sql everywhere, _javascript tips

Source: Internet
Author: User
You can actually do this:
Copy Code code 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 have SELECT \ INSERT \ UPDATE \ DELETE \ CREATE TABLE \ DROP TABLE
3. Last time I found out that DOM can actually be manipulated with SQL
For example, you can insert 100 images directly into the element operation as follows:
Copy Code code 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 update the SRC attribute of the picture element with update:
Copy Code code as follows:
("Update logolist set src= '" + Logo1 + ""). Fordom (). Execute ();

or delete these qualified elements:
Copy Code code as follows:
("Delete from logolist where title= ' Google '"). Fordom (). Execute ();


or act as a selector:
Copy Code code as follows:

var result = ("select * from Logolist"). Fordom (). Execute ();
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.