Forum Moderators: open
<html>
<head>
<title>
Pop-up Window
</title>
<script>
function dispPop()
{
features="height=400,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,top=200,left=200";
window.open("pop.html","a b c;",features);
}
</script>
</head>
<body>
<input type="button" onclick="dispPop();" value="pop-up"/>
</body>
</html>
change this...
"a b c;"
...to this...
"a_b_c"
...both the space and the semi-colon will cause IE to fail.
coothead
I just thought the escape method might also help.
The escape() method returns an encoded format of the input string.
if i use escape("a b c"), it doesn't work either.
it encodes "a b c" to a%20b%20c
Is it that the name parameter in pop-up doesn't accept even the encoded format?
well you do it like this...
<script type="text/javascript">
<!--
function dispPop() {
nme='a b c';
nme=nme.replace(/\s/g,'_');
features="height=400,width=500,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,top=200,left=200";
window.open("pop.html",nme,features);
}
//-->
</script>
birdbrain
The use of the window name should be unique. This is what it's for. This insures any new windows are indeed new instead of popping content into an existing one.
Scenario: two pop-up links on a page. User clicks one, new window with name a_b_c opens. User clicks back in main window, which puts a_b_c behind main window. User clicks link 2 and content loads in a_b_c, which is BEHINd the main window, unseen to the user, and their impression is likely "This site sucks, the link is broken!"
By assigning a unique identifier every time you open a new window, it will always open a NEW window:
var day = getDate();
var id = day.getTime();
var win = open(url,id, 'width=450,height=450,scrollbars, resizable');
Note also that yes and no are not required, either include the attribute or not.