Would there ever be any problems with the following script depending
on what type of characters are in the text string? I am appending the
value of hidden form field to the query string.
//Assume JavaScript enabled browsers and popups allowed.
//Function to open the window
function openWin(elm){
var nHeight = 250;
var nWidth = 250;
var nXpos = (screen.availWi dth - nWidth) / 2;
var nYpos = (screen.availHe ight - nHeight) / 2;
var desc=document.m yForm.elements[elm].value;
var statusPopup = window.open('de scription.htm?d esc=' +
desc,'popupWin' ,'top=' + nYpos + ',left=' + nXpos + ',screenY=' +
nYpos + ',screenX=' + nXpos + ',height=' + nHeight + ',width=' +
nWidth + 'location=no,me nubar=no,resiza ble=no,scrollba rs=no,statusbar =no,toolbar=no' );
}
<!-- Link example to call the function and hidden field -->
<a href="javascrip t:openWin('long desc2')">Descri ption</a>
<input type="hidden" name="longdesc2 " value="This is some text of Joe
Cool's & Jane Doe's." />
The is the script in the new window.
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#FFFFF F" text="#000000">
<script language="javas cript" type="text/javascript">
var description=loc ation.href.spli t('desc=');
if(description[1])
document.write( description[1].replace(/%20/g," "));
</script>
</body>
</html>