|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I read the "Building a WYSIWYG" article and thought it was COOL...
I need to cutomize the Editor to cater to our needs. My Mission is to create an unique id, write the content in a flat file, and save it on the server. I am able to get everything done but I am having some problems in the content of the iframe. When I create a form action tag to shoot to a eg. editor.jsp, I am able to retrieve the contents of the iframe from the editor.jsp. However, when I press the back button, the iframe's content is empty again. How do I get my previous iFrame content back? Any help is appreciated! Chris |
|
#2
|
|||
|
|||
|
basically you should use the same method that you use to get the data from the iframe.
iframeid.document.all.innerHTML = "value here" something like that, im just remembering this off the top of my head. |
|
#3
|
|||
|
|||
|
I had the same problem
I had the same problem a few days ago.
Here is the link to the answer... http://www.devarticles.com//forum/s...=&threadid=1447 It works! ![]() |
|
#4
|
|||
|
|||
|
<Script>
var iViewContentLoaded = false; function addContent() { if(!iViewContentLoaded) { if(iView.document.body) { //How do you fill this "#attributes.content#" var contents = "#attributes.content#"; iView.document.body.innerHTML = contents; iViewContentLoaded = true; } else { setTimeout("addContent()", 2000); } } } </script> <html> <body onload=addContent()> blah blah blah <table> <tr> <td> <input type="hidden" value="" name="htmlText"> </td> <td> <iframe id="iView" style="width: 415px; height:415px"scrolling="on" frameborder="1" src="editor.jsp"></iframe> </td> <td align="middle"> <input type="submit" name=submit value=submit onClick="processFormHtml()"> </td> </tr> </table> </body> </html> How do u populate "#attributes.content#" for this example? If I press the back button, the iframe content will have "#attributes.content#" . |
|
#5
|
|||
|
|||
|
hope this helps
The example I gave for you was for Cold Fusion. It appears you want to use JSP.
Change #attributes.content# to the variable name that contains your pre-existing content. You will probably need to run a query to do this, or you can hard code it I guess. In my instance, I didnt specify a source on my iframe. It appears you have. If you are doing the same thing I did, you don't need it. |
|
#6
|
|||
|
|||
|
I solved the problem..here is the code for jsp for reference
1st page is editor1.jsp and 2nd page is editor2.jsp 1st page <%String OUT=(String)session.getAttribute("html_out");%> <html> <head> <title> Browser Based HTML Editor </title> <script language="JavaScript"> var viewMode = 1; // WYSIWYG var iViewContentLoaded = false; var counter=0; function addContent() { alert(iViewContentLoaded); // Check to see if content has been loaded if(!iViewContentLoaded) { // Check to see if there is an iView.document.body object if(iView.document.body) { var contents = "<%=OUT %>"; // The object exists so populate it if(contents=="null") { contents=""; iView.document.body.innerHTML = contents; iViewContentLoaded = true; } else { iView.document.body.innerHTML = contents; iViewContentLoaded = true; } } else { // The object doesn't exist yet, so we'll try again in 2 seconds counter++; setTimeout("addContent()", 2000); } } } </script> </head> <body> blah blah blah <iframe id="iView" style="width: 415px; height:415px" scrolling="on" frameborder="1" src="editor.jsp"></iframe> </body> 2nd Page <%@ page import="java.util.*" %> <%@ page import="java.util.Date" %> <%@ page import="java.io.*" %> <%@ page import="org.w3c.dom.*" %> <%@ page import="org.w3c.dom.Document" %> <% String bankID= request.getParameter("bankID"); String html_out = request.getParameter("htmlText"); session.setAttribute("bankID",bankID); session.setAttribute("html_out",html_out); String ID1=(String)session.getAttribute("bankID"); String OUT=(String)session.getAttribute("html_out"); %> <html> <head> <title> Browser Based HTML Editor Confirmaton</title> <script language="JavaScript"> </script> </head> <body> <br> Bank ID: <%=ID1 %> <br> <%=OUT %> <form name="form2" action="editor3.jsp" method="post"> <br> <input type="submit" name=Accept value=Accept> </form> <form name="form3" action="editor1.jsp" method="post"> <input type="submit" name=Cancel value=Cancel> </form> </body> </html> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > inner HTML Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|