You are not logged in.
Pages: 1
Hi,
I want to dynamically read what has typed in Xinha reader without submitting the content. I use a javascript as follows.
<script type="text/javascript">
var old = '';
function update()
{
var textarea = document.getElementById('myTextArea');
var d = dynamicframe.document;
if (old != textarea.value)
{
old = textarea.value;
d.open();
d.write(old);
d.close();
}
}
</script>
but what I type in editor cannot b read by value of the text area. I saw there as a iframe created on run time by xinha with the id "XinhaIFrame_myTextArea". I can see the content in it using firebug. But I cannot get it's content too.
Can someone help me here.
Offline
Got it solved. for anyone interest following is how I get it done
<script type="text/javascript">
var old = '';
function update()
{
var textarea = document.getElementById('XinhaIFrame_myTextArea');
var con = textarea.contentWindow.document.body.innerHTML;
var d = dynamicframe.document;
if (old != con)
{
old = con;
d.open();
d.write(old);
d.close();
}
var frm = frames['dynamicframe'].document;
var otherhead = frm.getElementsByTagName("head")[0];
var link = frm.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", "files/full_example.css");
otherhead.appendChild(link);
}
</script>
Offline
Pages: 1