...

View Full Version : Going to the next line when setting a textarea's value using Jscript



greenham
10-18-2005, 11:55 AM
Hey all, thanks for at least checking out my thread.

Now what I want to know is when setting a textarea's value using Javascript, how do you 'Go to the next line'? I have tried '<br>' and obviously it didn't work, and I now realise how very stupid it was to even try it, anyway, if it helps this is the code I am using . . .



<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!--
var line = "First Line"
var secondLine = "Second Line"

function writing() {
line += secondLine
document.psword.txtarea.value = line

}
//-->
</SCRIPT>

</HEAD>

<BODY>
<FORM NAME="psword">
<textarea name="txtarea" cols="70" rows="30"></textarea>
</FORM>


<SCRIPT LANGUAGE="JavaScript">
<!--
writing()
//-->
</SCRIPT>


</BODY>

Bill Posters
10-18-2005, 12:07 PM
e.g.

function writing() {
line += "\n" + secondLine
document.psword.txtarea.value = line;
}

greenham
10-18-2005, 12:48 PM
Thank you so very very much Bill Posters! It's so great to have this forum. :) I am not much for Javascript knowledge, but if there is anything I can do to assist you in any of your projects, please let me know. Thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum