Dear all,
Context: JSP
I'm trying to get the value of a java variable and assign it to a javascript variable in order to later on use it in an iframe:
...
rs.next();
entry1 = rs.getString(3);%>
<SCRIPT>
var tt="<%=entry1%>";
var content = "<html><body>" + tt+ "</body></html>";
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var doc = iframe.document;
if(iframe.contentDocument)
doc = iframe.contentDocument; // For NS6
else if(iframe.contentWindow)
doc = iframe.contentWindow.document; // For IE5.5 and IE6
// Put the content in the iframe
doc.open();
doc.writeln(content);
doc.close();
</SCRIPT>
<%
If I take a look at the page source code I get this:
<SCRIPT>
var tt="<pre>A text,......text text text</pre>";
var content = "<html><body>" + tt+ "</body></html>";
var iframe = document.createElement("iframe");
document.body.appendChild(iframe);
var doc = iframe.document;
if(iframe.contentDocument)
doc = iframe.contentDocument; // For NS6
else if(iframe.contentWindow)
doc = iframe.contentWindow.document; // For IE5.5 and IE6
// Put the content in the iframe
doc.open();
doc.writeln(content);
doc.close();
</SCRIPT>
The value of the javascript variable tt from
var text="<%=entry1%>"; java variable is there! However, the value of tt is not displayed in the web page!!
What is wrong with this?
Thanks in advance,
Kind regards