473,800 Members | 2,529 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help for wiki website using simple javascript

2 New Member
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
1 1158
pbmods
5,821 Recognized Expert Expert
Heya, Sowmram. Welcome to TSDN!

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Sep 4 '07 #2

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

Similar topics

1
1663
by: Roel | last post by:
Hello, I have a simple script that will reload http://website/CAM1picture.jpg every xx minutes. I'm trying to add a form <input type="submit" value="CAM1" name="B1"><input type="submit" value="CAM2" name="B1"> So when I click on CAM2 button it will reload http://website/CAM2picture.jpg and when I click on CAM3 button it will reload http://website/CAM3picture.jpg and so on. I appreciate if someone can show me how to do it. Here's a...
1
1676
by: Shawn B. | last post by:
Greetings, I have have been working for almost 18 months on a set of WebControls where some are similar to the ASP.NET standard and well-enhanced while other controls are completely new and interesting. All my controls are implemented from scratch (in VB.NET). Some are C#, er I plan to have a second copy. I'm more productive in VB.NET (mainly because of the better intellisense support -- yes, I rely on it because I don't remember...
2
1990
by: Steve K | last post by:
I got a bit of a problem I like some help on. I'm designing an online training module for people that work in food processing plants. This is my target audience. These workers have little or no computer knowledge at all! And they also have outdated, old browsers, slow modems, old computers, etc. So I need to keep this as simple as possible and as browser compatible as possible. The client wants a navigation bar at the bottom of each...
1
1254
by: da404LewZer | last post by:
hell all, i'm starting a new wiki for programming called "CoderWiki" i plan on documenting all functions of all programming languages. I have started a couple portals for C, VB, PHP, HTML, Java, Smalltalk, etc, and just added a API Guide section for talking about the Google API, Win32 API, etc etc.
1
2189
by: relisoft | last post by:
SEATTLE, Washington. - July 12, 2006: Reliable Software® announces the upcoming release of Code Co-op® version 5.0. Code Co-op is an affordable peer-to-peer version control system for distributed development enabling collaboration through Email, LAN, or VPN-no server required. The upcoming release of Code Co-op 5.0 is due out this fall. With this release Reliable Software continues its track record of innovation by introducing...
8
1579
by: Dhananjay | last post by:
hello everyone Do you have any information how to generate a tool using .net which is used to translate the web page contents to html format. Plz reply me asap Thanks in advance Dhananjay
0
5577
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
6
1618
by: Michael Landberg | last post by:
Hi I am crewating a website using HTML and Javascript. The website can be seen by everybody that has internet. Do I have to consider that some people don't have javascript enabled in their browsers?? I mean If someone has disabled javascript they wont see some part of the website. Regards
19
3317
by: Ganesh J. Acharya | last post by:
Hi there, I want to redesign my website and make that look professional. I made this about 6 years ago with very little knowledge of internet. Today I am getting about 4000 visitors a day for the same. What are the things I need to keep in my mind when doing this process.
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.