PDA

View Full Version : Making textarea info appear in diff window


Rodzilla
06-27-2003, 12:35 PM
I'm new to JavaScript and am wondering how (newbie style, please) I can make text typed in a textarea box which is located in the left side of a 2-framed page appear in the right side of the framed page.

Here's what I have for the code:

function typetext()
{
var user_text = new String();
user_text = document.forms[0].userstext.value;
var x = user_text.length;
var stringArray = new Array();
if (x > 0)
{
for (var i = 0; i < stringArray.length; i++)
{
parent.output.document.write (stringArray[i]);
}
}
}

Here's my form portion:

<p><font style = "font-size: 10pt; color: #000000; font-family: tahoma, times new roman; font-weight:

bold">Type your text in this box</font>

<textarea name = "userstext" rows = "5" cols = "20" onSelect="typetext()" /></textarea></p>

I'm probably WAY off base but am trying.

Thank you!

arnyinc
06-27-2003, 01:58 PM
index.htm

<html>
<frameset rows="*,*">
<frame name="top" src="page1.htm">
<frame name="otherframe" src="page2.htm">
</frameset>
</html>

page1.htm

<html>
<body>
<textarea name="userstext" onkeyup="parent.otherframe.document.getElementById('remote').innerHTML=this.value;" rows="1" cols="20"></textarea>
</body>
</html>

page2.htm

<html>
<body>
<div id="remote"></div>
</body>
</html>

Rodzilla
06-28-2003, 12:10 PM
Thank you arnyinc, it worked. Now I just need to find out what some of the stuff means!