prefer.js db = openDatabase(masterDbName,version,displayName, MAXSIZE); db。 transaction ( function (tx) { tx .executeSql(' INSERT INTO首选项(date_format,paper_size,currency_symbol,password)VALUES(?,?,?,?) ',[$(' 。date option:selected')。val(), $(' #paper_size')。val(),$(' 。currency选项:选择')。val(),$(' .password选项:选择')。val()],populate_success,transaction_error); tx.executeSql( ' INSERT INTO params(date_format,paper_size,currency_symbol,enable_pword)VALUES(?,?,?,?)',[$( 。date option:selected' ).val(),$(' #paper_size')。val(),$(' 。currency选项:选择')。val(),$(' .password选项:选择')。val()],populate_success,transaction_error); }); params.js db = openDatabase(masterDbName,version,displayName,maxSize); db.transaction(函数(事务) { transaction.executeSql('insert into params(new_password,old_password,secret_question,secret_answer)值(?,?,?,?)',[$('#pass1')。val(),$('#pass2')。val(),$('#question')。val(),$ ('#answer')。val()],populate_success,transaction_error); }); 我希望问题清楚通过我的话..请帮助解决方案 params表如下所示: - newpassword,oldpassword,dateformat,papersize,enablepass,currency,secretq,secretans qwer,asdf, - , - , - , - ,dfg,dgdfg - , - ,dd / mm / yy,4,yes, , - , - dateformat,papersize ,enablepass和货币插入另一行:-my代码说也是这样,我需要知道如何将字段一起插入一行? 这样的事情: - params表: - newpassword,oldpassword,dateformat,papersize,enablepass,currency,secretq,secretans qwer,asdf,dd / mm / yy,4,yes, ,dfg,dgdfg prefer.js db =的openDatabase(masterDbName,版本,显示名,MAXSIZE); db。 transaction ( function (tx) { tx .executeSql(' INSERT INTO首选项(date_format,paper_size,currency_symbol,password)VALUES(?,?,?,?) , Prefer table(dateformat,papersize,enablepass,currency)params table(newpassword,oldpassword,dateformat,papersize,enablepass,currency,secretq,secretans)These are the two tables I am working with.Prefer table details insertion is done in prefer.js and params table in params.js.On insertion the datas are inserted like.for example:preferdateformat ,papersize ,enablepass ,currencydd/mm/yy , 4 , yes , $params table appears like this:-newpassword ,oldpassword, dateformat , papersize, enablepass , currency, secretq , secretansqwer , asdf , - , - , - , - , dfg , dgdfg - , - , dd/mm/yy , 4 , yes , $ , - , -the dateformat,papersize ,enablepass and currency is inserted in another line:-my code says to do the same, I need to know how to insert the fields together in one line?something like this:-params table:-newpassword, oldpassword, dateformat , papersize , enablepass , currency, secretq , secretansqwer , asdf , dd/mm/yy , 4 , yes , $ , dfg , dgdfg prefer.js db=openDatabase(masterDbName,version,displayName,maxSize); db.transaction(function (tx) { tx.executeSql('INSERT INTO preferences(date_format,paper_size,currency_symbol,password)VALUES(?,?,?,?)',[$('.date option:selected').val(),$('#paper_size').val(),$('.currency option:selected').val(),$('.password option:selected').val()],populate_success,transaction_error ); tx.executeSql('INSERT INTO params(date_format,paper_size,currency_symbol,enable_pword)VALUES(?,?,?,?)',[$('.date option:selected').val(),$('#paper_size').val(),$('.currency option:selected').val(),$('.password option:selected').val()],populate_success,transaction_error ); });params.js db=openDatabase(masterDbName, version, displayName,maxSize); db.transaction(function(transaction) { transaction.executeSql('insert into params(new_password,old_password,secret_question,secret_answer)values(?,?,?,?)',[ $('#pass1').val() ,$('#pass2').val(),$('#question').val(),$('#answer').val()],populate_success,transaction_error ); });I hope the question is clear by my words..please help 解决方案params table appears like this:-newpassword ,oldpassword, dateformat , papersize, enablepass , currency, secretq , secretansqwer , asdf , - , - , - , - , dfg , dgdfg - , - , dd/mm/yy , 4 , yes ,, - , -the dateformat,papersize ,enablepass and currency is inserted in another line:-my code says to do the same, I need to know how to insert the fields together in one line?something like this:-params table:-newpassword, oldpassword, dateformat , papersize , enablepass , currency, secretq , secretansqwer , asdf , dd/mm/yy , 4 , yes ,, dfg , dgdfg prefer.js db=openDatabase(masterDbName,version,displayName,maxSize); db.transaction(function (tx) { tx.executeSql('INSERT INTO preferences(date_format,paper_size,currency_symbol,password)VALUES(?,?,?,?)', 这篇关于Javscript-如何加入两个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-21 00:22