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!

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.

 

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.