473,326 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Create a wiki website where you can edit and save content

Hi,

I'm trying to create a site very similar to wiki, where you can edit, save.. Generally update data for the future use... This particular program I wanna do it using javascripts...

Please help me out in getting into the solution for the same...


Sample prg which I hve done is as below... Looking forward for all of your help...Thanks in advance

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. </head>
  4. <body>
  5.  
  6. <!--<script src="Editting.js">
  7. </script>-->
  8.  
  9. <SCRIPT TYPE=text/javascript>
  10.  
  11. var editing  = false;
  12.  
  13. if (document.getElementById && document.createElement) {
  14.     var butt = document.createElement('BUTTON');
  15.     var buttext = document.createTextNode('Save!');
  16.     butt.appendChild(buttext);
  17.     butt.onclick = saveEdit;
  18. }
  19.  
  20. function catchIt(e) {
  21.     if (editing) return;
  22.     if (!document.getElementById || !document.createElement) return;
  23.     if (!e) var obj = window.event.srcElement;
  24.     else var obj = e.target;
  25.     while (obj.nodeType != 1) {
  26.         obj = obj.parentNode;
  27.     }
  28.     if (obj.tagName == 'TEXTAREA' || obj.tagName == 'A') return;
  29.     while (obj.nodeName != 'P' && obj.nodeName != 'HTML') {
  30.         obj = obj.parentNode;
  31.     }
  32.     if (obj.nodeName == 'HTML') return;
  33.     var x = obj.innerHTML;
  34.     var y = document.createElement('TEXTAREA');
  35.     var z = obj.parentNode;
  36.     z.insertBefore(y,obj);
  37.     z.insertBefore(butt,obj);
  38.     //z.removeChild(obj);
  39.     y.value = x;
  40.     y.focus();
  41.     editing = true;
  42. }
  43.  
  44. function saveEdit() {
  45.     var area = document.getElementsByTagName('TEXTAREA')[0];
  46.     var y = document.createElement('P');
  47.     var z = area.parentNode;
  48.     y.innerHTML = area.value;
  49.     z.insertBefore(y,area);
  50.     z.removeChild(area);
  51.     z.removeChild(document.getElementsByTagName('button')[0]);
  52.     editing = false;
  53. }
  54.  
  55. document.onclick = catchIt;
  56.  
  57.  
  58.  
  59. </script>
  60.  
  61. <p>
  62. The actual script is in an external script file called "xxx.js".
  63. </p>
  64.  
  65. <input type="button" value="Edit" onClick="catchIt(e)">
  66. <input type="button" value="Save" onclick="saveEdit()">
  67. <input type="button" value="Ready">
  68.  
  69. </body>
  70. </html>
Sep 3 '07 #1
2 2436
dmjpro
2,476 2GB
Welcome to TSDN!
Actually what problem you are facing, please mention this.
Then I will be able to do solve your problem.

Kind regards,
Dmjpro.
Sep 4 '07 #2
acoder
16,027 Expert Mod 8TB
Changed the thread title to better describe the problem.
Sep 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rootshell | last post by:
I need to create the table and I want to edit its content from www level. Here is some example: http://www.rootshell.be/~flash44 There is a table. Is there possibilty to edit the content...
2
by: Robert Brewer | last post by:
Cross-posted here to encourage comments/discussion. I know there's a big feature or two I'm missing out on ;) Suggestions welcome. Tibia is an in-browser editor for web pages. It allows you to...
4
by: ferg | last post by:
I've checked all the FAQs and help - spent a couple of hours on this now and it's really bugging me. I've got Moin 1.3.5 installed on IIS 5.0. I can view and edit pages without any problems, but...
302
by: Lee | last post by:
Hi Whenever I use the gets() function, the gnu c compiler gives a warning that it is dangerous to use gets(). Is this due to the possibility of array overflow? Is it correct that the program...
6
by: Peter.H.M.Brooks | last post by:
I'm looking for a good (ideally free), system for quite a big writing job. There will be some collaboration, but it is mainly on one system. I am keen to have easy to use indexing and...
11
by: raylopez99 | last post by:
Keep in mind this is my first compiled SQL program Stored Procedure (SP), copied from a book by Frasier Visual C++.NET in Visual Studio 2005 (Chap12). So far, so theory, except for one bug...
16
by: Mich | last post by:
Hi, i'm building an web application for anonymous users. They can take a look in the website, nothing more. In order to perform other actions, the anonymous user must be logged. So i create an...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.