我在他的电话差距领域工作。所以,我对电话差距和 Java 脚本都是新手。
我想访问同一屏幕上两个不同表中的数据。为了清楚起见,我希望 标题数据来自一个表,比如Table No-1,而正文数据来自另一个表。说表2。
我应该如何使用它?
这就是我目前使用表 1 的方式。
function onDeviceReady()
{
console.log("processing onDeviceReady!!! onDeviceReady");
var db = window.sqlitePlugin.openDatabase("abc", "1.0", "abc", 1000000);
console.log("processing onDeviceReady");
db.transaction(queryDB, errorCB);
}
function queryDB(tx,paramName)
{
tx.executeSql("SELECT * FROM Table No-1 , [], querySuccess, errorCB);
}
我的疑问是我应该在哪里给 Table No-2 ?
编辑版本--->这是我尝试实施的方法:
function onDeviceReady(paramName)
{
console.log("processing Causeee!!! onDeviceReady");
var db = window.sqlitePlugin.openDatabase("abc", "1.0", "abc", 1000000);
console.log("processing onDeviceReady");
var searchString = window.location.search.substring(1),i, val, params = searchString.split("&");
for (i=0;i<params.length;i++)
{
val = params[i].split("=");
if (val[0] == paramName)
{
return unescape(val[1]);
}
value=val[1];
console.log("valueeesss: "+val[1]);
cid_value=parseInt(value)+parseInt(1);
db.transaction(queryDB, cid_value,value);
}
}
function queryDB(tx, results,paramName)
{
tx.executeSql("SELECT cid,value FROM table1 where cid="+cid_value, [], errorCB,cid_value,value);
console.log("processing queryDB");
var mySwiper = new Swiper('.swiper-container', {
speed:20,mode:'horizontal'})
var details = results.rows.length;
for (var i=0; i < details ; i++)
{
cidinstance=results.rows.item(i).cid;
var valueinstance=results.rows.item(i).value;
console.log("cid = "+cidinstance + " | valueinstance = "+valueinstance);
var val = i;
var superdiv = document.getElementById('swiper-wrapper');
var newdiv = mySwiper.createSlide('div');
newdiv.append();
var divIdName = 'swiper-slide'+val;
newdiv.setAttribute('id',divIdName);
newdiv.className="swiper-slide";
superdiv.appendChild(newdiv);
var cnt = '<div id="container'+val+'" class="container_cause" style="background:url(img/cause_value_bg.png) no-repeat scroll 0 0 transparent; "><div id="cause'+val+'" class="clinical_slide"><span ><h5>'+results.rows.item(i).value+'</h5></span></div></div><div class="pagination1"></div>';
console.log("check value"+cnt);
document.getElementById(divIdName).innerHTML=cnt;
console.log("processsing parameter loop ");
}
----
}