JavaScript not loadingOptions
Edit Message
Mark as New
Bookmark
Subscribe
Subscribe to RSS Feed
Highlight
Print
Email to a Friend
Report Inappropriate Content
07-19-2010 12:48 PM
HI,
I am trying to make a Sqlite project using gears API. I have
downloaded the gears_init.js file locally. The sample application for
Gears povided by BB is woking fine. But when I am tring to modify the
same & use in my application the javascripts (action.js) do not load.
The index.html page is loaded but none of the javascripts are invoked.
BB simulator : Storm 9550, 5.0.0.469
Browser :blackberry
N/w : both CDMA & GSM
THe index.html file:
title>Data Storage Example</title>
<link href="Styles/styles.css" rel="stylesheet" type="text/css" />
<script src="http://www.google.com/jsapi?
key=ABQIAAAAsm1sbQmJWbgLoP7i4K2WdBR_SoAUqeLrvjUVmFG1nkbo-
KiRrxRswNhze0oP..." type="text/javascript"></script>
<script src="Scripts/action.js" type="text/javascript"></script>
<script src="Scripts/gears_init.js" type="text/javascript"></
script>
<script type="text/javascript">
function myAlert(){
alert("Alert from HTML");
}
</script>
</head>
<body onload="javascript: demoAlert(); myAlert();
openDatabase(); populateShoppingListTable()">
<div>
<p class="header">Save shopping list items</p>
</div>
<div>
<p class="listTitle">Items</p>
<input type="text" id="txtItem" />
<br/>
<br />
<input type="button" value="Add item to list"
onclick="addShoppingListItem(document.getElementById('txtItem').value)" /
>
</div>
The action.js file:
// Global handle to the database
var _db;
// Open the database using Google Gears API and create a table if
needed
function openDatabase() {
alert("kasiey ho anna");
var db = google.gears.factory.create('beta.database1');
db.open('itemSet1');
db.execute('create table if not exists ShoppingListTable (Serial
text unique, ItemName text, PurchaseStatus text, Rate text, Qauntity
text)');
_db = db;
}
function demoAlert(){
alert ("I am a jokings");
}
// Save the selected Items
/*function saveItems(item) {
try {
// Add the link into the database if the checkbox is checked
_db.execute('insert into Items values (?)', [item]);
// Update the table
populateTable();
}
catch (e) {
alert(e);
}
}*/
function addShoppingListItem(itemname) {
try {
alert(itemname);
var count = _db.execute('Select COUNT(ItemName) from
ShoppingListTable');
var serialNum = count+1;
// Add the link into the database if the checkbox is checked
_db.execute('insert into ShoppingListTable (Serial, ItemName)
VALUES ('+ serialNum + ', '+itemname+')');
//@@@@@@@@@@@@@@@@@Select COUNT(Supplier_ID) from suppliers
// Update the table
populateShoppingListTable();
}
catch (e) {
alert(e+"In add Shopping Item");
}
}