WYSIWYG in-browser editor

windows

Guest
I've created an in-browser WYSIWYG editor for a content management tool with help from this tutorial:<br />
<!-- m --><a class="postlink" href="http://www.devarticles.com/art/1/90/">http://www.devarticles.com/art/1/90/</a><!-- m --><br />
<br />
My question is: How can I hard-code some text into that editor box? it works fine for just adding records but I'm finding it difficult to write the code back into the box to allow the user to edit it.<br />
<br />
I'm using ASP but that's not important really - I just need to be able to know how to insert code for the user to then edit (For some reason I'm finding this fairly difficult to explain).<br />
<br />
The bit I need to edit is this:<br />
<iframe id="iView" style="width: 415px; height:205px"></iframe> <br />
<br />
I hope it make sense...<br />
<br />
Cheers<br />
T.<!--content-->not sure if I understand what it is you're trying to do, but can you use document.getElementById('iView').style.innerHTML="variable_containing_your_code";<br />
or:<br />
..<br />
document.getElementById('iView').style.innerHTML="variable_containing_your_code";<br />
</script><br />
...<br />
<iframe id="useredit" style="width: 415px; height:205px"><div id="useredit"></div></iframe><!--content-->Thanks for the reply Iain - I think your on the right track.. although I'm still having trouble getting it to work (I don't often mess with javascript)<br />
<br />
I think it should be added somewhere in this bit of code that's in the supplied javascript file:<br />
<br />
iText = iView.document.body.innerText;<br />
iView.document.body.innerHTML = iText;<br />
i<br />
<br />
<br />
...Although I have no idea where or how...<!--content-->can you post more of the code, or a link? It's hard to understand from just a few lines. Where is the code that you want to insert coming from?<br />
<br />
The correct syntax to work in ie and netscape isdocument.getElementById('title').innerHTML=titleI think the code you have will fail in netscape. I'm not sure on the difference between innerHTML and innerText, whether they're different syntax for the same thing, or the former includes tags and the latter doesn't. I'll check it out.<!--content-->Not bothered about netscape - it's not going to be set loose to the public - just specific people. You should be able to find the source code from that link I gave on my first post<!--content-->right, so you need to develop a code saying if a certain condition is true (don't know what the condition is), then take text or code from a certain place (you haven't said where) and use the syntax we've talked about to assign that code to iText and then make the iView's inside (not sure if you want this to be HTML (includes tags inside the frame) or just text - in your first post you say 'code', so i'd guess the former).<br />
<br />
If you post more information about the above, and anything else, i can help more, right some code for you. Again, key point is where is this 'code' that you want in the frame coming from - another file? How are planning of getting it? you could use ssi.<br />
<br />
As i say, more info needed :)<!--content-->Sorry - I'll try and explain what I'm doing a bit clearer.<br />
<br />
I have a bit on a website that someone wants to be able to update themselves but they don't have any knowledge of html so I've created a little content management tool for them which updates the database which the page on the website reads from.<br />
<br />
Now because they know nothing of html I've found this WYSIWYG editor code that's built into IE. It works fine insofar as they can enter their content and post it into the database. However, they need to be able to go back and edit this and this is where I am stuck. I don't have a problem with getting the code from the database and into the page - it's just with knowing where to stick this data so it populates that WYSIWYG editor.<br />
<br />
Hopefully this makes more sense..<!--content-->okay, that sounds good - can you show me the code you use to get the data from the database to the page? Then we just assign that to a variable, and then then assign the variable to the frame, as we've talked about.<br />
<br />
Iain<!--content-->I'm just using a standard recordset which brings in the data I require which is assigned to a variable already.<br />
<br />
For example, before I came up with this idea, I was using a standard textarea form box:<br />
<TEXTAREA name="bodyText" cols="60" rows="18"><%= varBodyText %></TEXTAREA><!--content-->
 
Back
Top