Support Forums

Full Version: [How-to] Edit Websites [JavaScript]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is very simple javascript, which allows you to edit websites. NO, it won't be edited, only you can see it. After refresh everything's back to normal.

Here's the code:

Code:
javascript: document.body.contentEditable = 'true'; document.designMode = 'on'; void 0

Just paste it in the website you want to edit in the URL.

Enjoy. Oui
There are way better ways to use this function, one is a rich text editing...
Here is a small rich text editor I wrote in 5mins.... You can take a look at it...

Code:
<html>
    <head>
        <title>RichText using contentEditable</title>
        
        <style type="text/css">
            #richTextBox {
                width:500px;
                height:200px;
                overflow:scroll;
                border:1px solid black;
                padding:5px;
            }
        </style>
        <script language="javascript" type="text/javascript">
            function rtbFormat(command, value) {
                document.getElementById("richTextBox").focus();
                document.execCommand(command, false, value);
            }
        </script>
    </head>
    
    <body>
        <input type="button" name="boldText" onclick="rtbFormat('Bold', '');" value="Bold" />
        <input type="button" name="fontName" onclick="rtbFormat('FontName', 'Georgia');" value="Font: Georgia" />
        <input type="button" name="fontSize" onclick="rtbFormat('FontSize', 22);" value="Font: 22" />
        <input type="button" name="textAlign" onclick="rtbFormat('JustifyCenter', '');" value="Center Text" />
        <div id="richTextBox" contenteditable></div>
    </body>
</html>

And here a little preview:
[Image: QCJOY.png]

It's just that the use of the function you're showing is simply pointless and not needed.
Java and Javascript are two different things. Dont confuse the two.