javascript - sql.js GUI example - Force a specific database instead of select one -


I am trying to use to create a simple local SQLite database browser without any server interaction.

I'm using to test.

HTML GUI example page & lt; Input type = 'file' id = 'dbfile' & gt; allows users to select the database file, then the HTML page calls GUI.JS like this:

  var dbFileElm = document.getElementById ('dbfile'); // Load a DB from the file dbFileElm.onchange = function () {var f = dbFileElm.files [0]; Var r = new FileReader (); R.onload = function () {worker.onmessage = function () {toc ("Loading database from file"); // Show the schema of the loaded database editor Set val ("SELECT` name`,` sql` \ n from 'sqlite_master` \ n where type =' table '; "); ExecEditorContents (); }; Tic (); {Worker.postMessage ({Action: 'Open', Buffer: R. Russelt}, [R. Russell]); } Catch (exception) {worker.postMessage ({Action: 'Open', buffer: R. Page)}; }} R.readAsArrayBuffer (f); }  

And it's working fine.

Now I want to emphasize the specific database name and location. I try to use: & lt; Input type = 'text' value = '& lt; MY_DB_FILE & gt; ' Id = 'dbfile' & gt; (Where MY_DB_FILE is the name of my DB file in the same folder as the HTML page) I also

dbFileElm.onchange =} ( to DbFileElm.onload = function ()

but nothing works; ID dbfile does not contain any useful data and the function is not called.


Comments