Ok. I am working on a content mgt system that will allow for direct page edits from authorized computers (using a cookie).
I have the part of identifying page and div ids and the changed text to store to a MySQL table. What I am missing is the ability to identify styles associated with those divs and ensure that the style is applied when I update the innerHTML property.
Here is some of what I am using to get the current text of the element (div).
That code is on my page that I want to modify, so that divid returns the divid of the div I have stored text for in my DB based on the pageid
So what I am trying to figure out (I am not a DOM expert) is how to get, store and apply the styling that is on the page. The storing is no prob (I just use AJAX methods to send to my table along with page and divid.
Any help would be greatly appreciated. This will give me a good way for my inexperienced users at Church to make easy updated to certain site content without having some kind of console or admin screen.
Thanks!
LJ Wilson
My personal saying - Just remember, it can always get worse, and usually will.
I have the part of identifying page and div ids and the changed text to store to a MySQL table. What I am missing is the ability to identify styles associated with those divs and ensure that the style is applied when I update the innerHTML property.
Here is some of what I am using to get the current text of the element (div).
Code:
<script type="text/javascript">
<!--
var mypageid = pageid();
var pagedata = getpagedata(mypageid);
var len= pagedata['numdivs'];
var divid;
var divtext;
for (var i=0; i<len; i++)
{
divid = pagedata['div'][i];
divtext = pagedata['text'][i];
document.getElementById(divid).innerHTML = "<p>" + divtext+ "</p>";
}
// -->
</script>
That code is on my page that I want to modify, so that divid returns the divid of the div I have stored text for in my DB based on the pageid
Code:
function pageid()
{
var myPath = window.location.pathname;
var myPage = sPath.substring(sPath.lastIndexOf('/') + 1);
return(myPage);
}
So what I am trying to figure out (I am not a DOM expert) is how to get, store and apply the styling that is on the page. The storing is no prob (I just use AJAX methods to send to my table along with page and divid.
Any help would be greatly appreciated. This will give me a good way for my inexperienced users at Church to make easy updated to certain site content without having some kind of console or admin screen.
Thanks!
LJ Wilson
My personal saying - Just remember, it can always get worse, and usually will.