Support Forums
[How-to] Edit Websites [JavaScript] - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Life Support (https://www.supportforums.net/forumdisplay.php?fid=12)
+---- Forum: Omni's Secret Hidden Inside Tricks (https://www.supportforums.net/forumdisplay.php?fid=13)
+---- Thread: [How-to] Edit Websites [JavaScript] (/showthread.php?tid=3860)



[How-to] Edit Websites [JavaScript] - flAmingw0rm - 12-22-2009

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


RE: [How-to] Edit Websites [JavaScript] - Gaijin - 12-23-2009

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.


RE: [How-to] Edit Websites [JavaScript] - Project Evolution - 12-23-2009

Java and Javascript are two different things. Dont confuse the two.