我正在尝试将用户输入的信息存储到Web SQl上,我遇到的问题是没有输入日期,例如,如果所选日期是2019-02-26,则输入的日期结束1991年,有人可以帮我这个忙吗
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum- scale=1, minimum-scale=1, width=device-width" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="http://www.datejs.com/build/date.js" type="text/javascript"> </script>
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<section id="page" data-role="page">
<header data-role="header">
<h1>Header</h1>
</header><!-- /header -->
<article data-role="content">
Date entered:
<input type="date" id="time">
<button onclick="AddInput()">Enter</button>
</article><!-- /content -->
<footer data-role="footer">
<h1>Footer</h1>
</footer><!-- /footer -->
</section><!-- /page -->
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
</script>
</body>
</html>
javaScript:
function AddInput(){
var date = $("#time").val();
else{
alert(date);
var sql = "INSERT INTO STORAGEAPP (date_enter) VALUES ('"+date+"') ";
db.transaction(function (tx) {
tx.executeSql(sql);
});
alert("Complete");
}
}
var db = openDatabase('storageDb', '1.0', 'Storage app database', 5 * 1024 * 1024);
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS STORAGEAPP (id INTEGER PRIMARY KEY AUTOINCREMENT, userName TEXT, date_enter DATE, sType TEXT, Dimension INTEGER, Feature TEXT, Rent_per_month INTEGER)');
});