I have a page, where some of the text will be a clickable link, that brings up a popup window. When the user clicks on the link, and the popup window opens, all the values from the text boxes are brought into the page, via the querystring. To get the value of the box in question, I use this method "fieldname=form.fieldname.value", which works just fine, except if users enter a % or a # sign, in which case, the % just disappears, and the # doesn't show anything entered AFTER the # sign. Here is the function I use to popup the window:
var detailsWindow;
function NewWindow(URL, varwidth, varheight)
{
//var w=0,h=0
var width=varwidth, height=varheight;
//ReplaceChars(URL)
//detailsWindow = window.open(URL,'none','width='+width+',height='+height+'');
detailsWindow = window.open(URL,'none','width='+width+',height='+height+',top=0,left=0,scrollbars=yes');
return false;
}
and in the HTML, to call this, I use this for the text, describing the text field:
onclick="NewWindow('updateudfdetail.asp?category=1&Field1='+form.Field1.value+'&Field2='+form3.Field2.value+'',300,600);"
Here is a little something I tried to come up with, using the Escape() function. It doesn't give any errors, but when I click on the link, and it brings up the popup window, it takes me to a page that does not exist, as the URL is undefined.
function ReplaceChars(Link)
{
var Link;
//var URL2;
//for (i = 0; i > URL.length; i++) {
// if (URL.search("#"
)
Link = Link.replace("%",escape("%"
);
Link = Link + Link.replace("#",escape("#"
)
// }
//URL2 = URL.replace("#",escape("#"
)
}
If someone could help me out, I'd be much appreciative. I'm a novice JavaScript user. Even the novices call me a novice. Thanks.
var detailsWindow;
function NewWindow(URL, varwidth, varheight)
{
//var w=0,h=0
var width=varwidth, height=varheight;
//ReplaceChars(URL)
//detailsWindow = window.open(URL,'none','width='+width+',height='+height+'');
detailsWindow = window.open(URL,'none','width='+width+',height='+height+',top=0,left=0,scrollbars=yes');
return false;
}
and in the HTML, to call this, I use this for the text, describing the text field:
onclick="NewWindow('updateudfdetail.asp?category=1&Field1='+form.Field1.value+'&Field2='+form3.Field2.value+'',300,600);"
Here is a little something I tried to come up with, using the Escape() function. It doesn't give any errors, but when I click on the link, and it brings up the popup window, it takes me to a page that does not exist, as the URL is undefined.
function ReplaceChars(Link)
{
var Link;
//var URL2;
//for (i = 0; i > URL.length; i++) {
// if (URL.search("#"
Link = Link.replace("%",escape("%"
Link = Link + Link.replace("#",escape("#"
// }
//URL2 = URL.replace("#",escape("#"
}
If someone could help me out, I'd be much appreciative. I'm a novice JavaScript user. Even the novices call me a novice. Thanks.