textarea content in popup window?
hi,
i am sending textarea values to popup window,
if i entered text content like
abc
xyz
uuu
but in popup window i am getting
abcxyzuu
but i want display in popup window same as enter in text area ?
any one knows please help me?
-
code
--
<html>
<header>
<script language="JavaScript" type="text/javascript">
function openPriview()
{
var q1 =document.form1.headerTxt.value;
var q2 =document.form1.content1.value;
var q3 =document.form1.content2.value;
window.open('PreviewPage2.jsp?txtHd='+q1+'&txtCon1='+document.form1.content1.value+'&txtCon2='+q3,'PreviewPage','width=320,height=240,scrollbars=yes');
}
</script>
</header>
<body bgcolor = "pink">
<form name="form1" action="ValidateProcess.jsp">
<table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>Header</td>
<td></td>
</tr>
<tr>
<td><input type ="text" name="headerTxt" maxlength="80"></td>
<td></td>
</tr>
<tr>
<td>Content1</td>
<td></td>
</tr>
<tr>
<td><textarea rows="10" cols="10" name="content1"></textarea></td>
<td></td>
</tr>
<tr>
<td>Content2</td>
<td></td>
</tr>
<tr>
<td><textarea rows="5" cols="20" name="content2"></textarea></td>
<td></td>
</tr>
<tr>
<td>
<input TYPE="button" VALUE="Preview JS" onClick="openPriview()">
<input TYPE="button" VALUE="Preview" onClick = "nextPagePreview()" >
</td>
<td align="left"><input type="submit" name="submit" value="Done" ></td>
</tr>
</table>
</form>
</body>
</html>
Thanks
sai
[nobr]try this:
<html>
<header>
<script language="JavaScript" type="text/javascript">
function openPriview()
{
var q1 =document.form1.headerTxt.value;
var q2 =document.form1.content1.value;
var q3 =document.form1.content2.value;
window.open('PreviewPage2.jsp?txtHd='+q1+'&txtCon1='+document.form1.content1.value+'&txtCon2='+q3,'PreviewPage','width=600,height=600,scrollbars=yes');
}
</script>
</header>
<body bgcolor = "pink">
<form name="form1" action="ValidateProcess.jsp">
<table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td>Header</td>
<td></td>
</tr>
<tr>
<td><input type ="text" name="headerTxt" maxlength="80"></td>
<td></td>
</tr>
<tr>
<td>Content1</td>
<td></td>
</tr>
<tr>
<td><textarea rows="10" cols="10" name="content1"></textarea></td>
<td></td>
</tr>
<tr>
<td>Content2</td>
<td></td>
</tr>
<tr>
<td><textarea rows="5" cols="20" name="content2"></textarea></td>
<td></td>
</tr>
<tr>
<td>
<input TYPE="button" VALUE="Preview JS" onClick="openPriview()">
<input TYPE="button" VALUE="Preview" onClick = "nextPagePreview()" >
</td>
<td align="left"><input type="submit" name="submit" value="Done" ></td>
</tr>
</table>
</form>
</body>
</html>
'PreviewPage2.jsp
<%@ page contentType="text/html;charset=windows-1252"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<script language="JavaScript" type="text/javascript">
function setPriview(){
document.popUpForm.headerTxt.value = opener.document.form1.headerTxt.value;
document.popUpForm.content1.value = opener.document.form1.content1.value;
document.popUpForm.content2.value = opener.document.form1.content2.value;
}
function setText(val){
var tempText = "";
for(var x = 0;x<val.length;x++){
if(val.charCodeAt(x)!=10 && val.charCodeAt(x)!=13){
tempText = tempText + val.charAt(x);
}else{
if(val.charCodeAt(x)==10){
tempText = tempText + "><br/>";
}
}
}
return tempText;
}
</script>
</head>
<body onload="setPriview()">
<form name="popUpForm">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Header</td>
<td/>
</tr>
<tr>
<td>
<input type="text" name="headerTxt" maxlength="80"/>
</td>
<td/>
</tr>
<tr>
<td>Content1</td>
<td/>
</tr>
<tr>
<td>
<textarea rows="10" cols="10" name="content1"></textarea>
</td>
<td/>
</tr>
<tr>
<td>Content2</td>
<td/>
</tr>
<tr>
<td>
<textarea rows="5" cols="20" name="content2"></textarea>
</td>
<td/>
</tr>
<tr>
<td>Header</td>
<td/>
</tr>
<tr>
<td>
<script language="JavaScript">document.write(setText(opener.document.form1.headerTxt.value));</script>
</td>
<td/>
</tr>
<tr>
<td>Content1</td>
<td/>
</tr>
<tr>
<td>
<script language="JavaScript">document.write(setText(opener.document.form1.content1.value));</script>
</td>
<td/>
</tr>
<tr>
<td>Content2</td>
<td/>
</tr>
<tr>
<td>
<script language="JavaScript">document.write(setText(opener.document.form1.content2.value));</script>
</td>
<td/>
</tr>
</table>
</form>
</body>
</html>
[/nobr]