Hey y'all,
I am in need of some help...I am building a internal website for my department and I am using JavaScript to pull data from a local database since our corp office is being stingy and won't give me any web server space...
I am pulling html code out of the database via javascript and putting it into a div tag so there is only one page, and making it easier for my less-than-computer smart people in my office when they have to update a page. It's a real basic content management system. What I need help with is, I can't seem to figure out the best approach to pushing the data into a div tag or textarea for the wysiwyg inpage editor can recognize it. I can display it fine on the page because I'm using an inline script to pull it from the database onload.
I am trying to write a script that I can call onload that will write the HTML to the DIV...the first approach pulls in the actual code for the script and not the data from the db.
I've tried innerHTML, insertAdjacentH TML and a straight text approach with no success. I do not need cross-browser functionality as we are only able to use IE.
Below is my code, anyone have any ideas on what I can do alternatively?
TIA for the assistance!
I am in need of some help...I am building a internal website for my department and I am using JavaScript to pull data from a local database since our corp office is being stingy and won't give me any web server space...
I am pulling html code out of the database via javascript and putting it into a div tag so there is only one page, and making it easier for my less-than-computer smart people in my office when they have to update a page. It's a real basic content management system. What I need help with is, I can't seem to figure out the best approach to pushing the data into a div tag or textarea for the wysiwyg inpage editor can recognize it. I can display it fine on the page because I'm using an inline script to pull it from the database onload.
I am trying to write a script that I can call onload that will write the HTML to the DIV...the first approach pulls in the actual code for the script and not the data from the db.
I've tried innerHTML, insertAdjacentH TML and a straight text approach with no success. I do not need cross-browser functionality as we are only able to use IE.
Below is my code, anyone have any ideas on what I can do alternatively?
TIA for the assistance!
Code:
function getDoc()
{
var cn = new ActiveXObject("ADODB.Connection");
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = /App_Data/OGU.mdb;Persist Security Info=False";
cn.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var input = window.top.location.search.substring(1);
var inputStr = input.substr(3);
var SQL = "select Data from Data where DataId = " + inputStr + ";";
rs.Open(SQL, cn);
var returnResults = rs(0);
document.getElementById("content").innerHTML = returnResults;
rs.Close();
cn.Close();
}
Comment