Jump to content

[SOLVED] Making a div that people can write in.


blufish

Recommended Posts

Okay, I think this will be a little hard but the problem is I don't know where to start, what I want is a div which people can click on and the little flashing | comes and they can write code and whatever else they wish to write into it.  It doesn't HAVE to be a div it could be a textarea if that would work. 

 

example:

www.googlepages.com

When you edit your pages it's like a wysiwyg

 

Thanks all!

Link to comment
Share on other sites

The example he had didn't execute the code which is what I need.  I have this if anyone is willing to help me understand why it isn't working.

<html>
<head>
<title>Edit your page!</title>
<script type="text/javascript">
function change()
{
document.contents.contenteditable="false";
}
</script>
</head>
<body>
<input type="button" onclick="change()" value="Change">
<div name=contents CONTENTEDITABLE="true" STYLE="border: 5px dashed black; width:90%; height: 90%;"></div>
</body>
</html>

It should take away the contenteditable thing but it doesn't.

 

Link to comment
Share on other sites

I have this code which outputs what I write into a div below which will work, but my problem is that in flock and safari it executes the HTML code, but in IE it does not.  any ideas?

<html>
<head>
<script type="text/javascript">
function sendtoDiv(){
document.getElementById("divbox").innerHTML = document.getElementById("textarea").value;
}
</script>
</head>

<body>

<textarea id="textarea" onkeyup="sendtoDiv()"></textarea>
<div id="divbox"></div>

</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.