J
johkar
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.availWidth - nWidth) / 2;
var nYpos = (screen.availHeight - nHeight) / 2;
var desc=document.myForm.elements[elm].value;
var statusPopup = window.open('description.htm?desc=' +
desc,'popupWin','top=' + nYpos + ',left=' + nXpos + ',screenY=' +
nYpos + ',screenX=' + nXpos + ',height=' + nHeight + ',width=' +
nWidth + 'location=no,menubar=no,resizable=no,scrollbars=no,statusbar=no,toolbar=no');
}
<!-- Link example to call the function and hidden field -->
<a href="javascriptpenWin('longdesc2')">Description</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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script language="javascript" type="text/javascript">
var description=location.href.split('desc=');
if(description[1])
document.write(description[1].replace(/%20/g," "));
</script>
</body>
</html>
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.availWidth - nWidth) / 2;
var nYpos = (screen.availHeight - nHeight) / 2;
var desc=document.myForm.elements[elm].value;
var statusPopup = window.open('description.htm?desc=' +
desc,'popupWin','top=' + nYpos + ',left=' + nXpos + ',screenY=' +
nYpos + ',screenX=' + nXpos + ',height=' + nHeight + ',width=' +
nWidth + 'location=no,menubar=no,resizable=no,scrollbars=no,statusbar=no,toolbar=no');
}
<!-- Link example to call the function and hidden field -->
<a href="javascriptpenWin('longdesc2')">Description</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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<script language="javascript" type="text/javascript">
var description=location.href.split('desc=');
if(description[1])
document.write(description[1].replace(/%20/g," "));
</script>
</body>
</html>