Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store DOM style?

Status
Not open for further replies.

zinja

MIS
Nov 14, 2002
149
US
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).

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top