快捷搜索:   nginx

SQL语句在JavaScript中的应用(4)

 <script type="text/javascript">
  title1 = "google";
  title2 = "baidu";
  logo1 = "images/google.gif";
  logo2 = "images/baidu.gif";
  function switchlogos() {
   //alert('switch');
   var tmplogo = logo1;
   var tmptitle = title1;
   logo1 = logo2;
   title1 = title2;
   logo2 = tmplogo;
   title2 = tmptitle;
   ("update logolist set src='" + logo1 + "', title='" + title1 + "'").ForDOM().execute();
  };
  '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();
  };
  //("delete from logolist where (1=1)").ForDOM().execute();

 </script>
</body>
</html>

[/code]

其中,还用到了JSQL的DOM元素插入操作:

[code="js"]

'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();
  };

2.JSQL应用案例:基于客户端的成绩统计

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Marks Count</title>
<script type="text/javascript" src="../src/YESBRAIN.js"></script>
<script type="text/javascript" src="../src/JSQL.js"></script>
<script type="text/javascript" src="../src/JSQL-Memory.js"></script>
<script type="text/javascript" src="../src/JSQL-DOM.js"></script>
<style>
 #marks input {
  width: 100px;
 }
</style>

</head>
<body>
<center>
<h1>Marks Count</h1>
<p>
 <button onclick="insertline();"> Add one line </button>
 <button onclick="savemarks();"> Save Changes </button>
 <span>By<span>

顶(2)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论