...

View Full Version : approach to online javascript editing?



turpentyne
09-22-2011, 06:56 PM
I'm almost positive this question will make you groan "neewwwbie!"....

I have a simple javascript that decides which 'div' to make visible, based on another element within the html.

What i want now is to create a page where someone can view all the possible divs in that javascript that might appear and edit them (including href's, ital, bold and image tags.) Much like a CMS system, but the information is within a javascript, not a database.

I would assume it's possible. What's a good way to approach this? It sounds like Javascript cannot edit .txt files. Is there a way to have the user access and edit an .xml file and just pull that into the div tag, instead of text?

Old Pedant
09-22-2011, 08:02 PM
Short answer: No.

Oh, the user could modify the contents of XML or the contents of a <div> or or or ...

But then what?

*ONLY* that user could see the results of that modification. (You could use cookies to save the user's changes from one session to the next, so at least the user's changes could persist...until he/she deletes the cookies!)

No other user could see the changes.

For that, you *MUST* use some server-side system to store the changes. PHP/ASP/JSP/whatever. Any of them could work. But *not* JavaScript with HTML, alone.

rnd me
09-23-2011, 12:08 AM
would they be changing the page for just themselves, or would changes need to be shared with everyone?

both are possible with js, though to share with others, youll need to use a webservice like google doc's forms to save and YQL to pull it back out.

if it's all local, it's trivial: look into window.localStorage



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum