-
Aug 22nd, 2012, 08:02 AM
#1
Thread Starter
Fanatic Member
javascript window.open not working in IE
Hi, Im using a custom function to open window most of the time it works in IE,FF and CHROME but when I pass the value
Code:
onclick="popupwindow01('supplier.aspx?src=rpt&tar=costcentre','Page Title',400,500);"
in IE debugger local window it shows
HTML Code:
url
value="supplier.aspx?src=rpt&tar=costcentre"
type=String
title
value="Page Title"
w=400
h=500
Code:
function popupwindow01(url, title, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/3)-(h/2);
window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left).focus();
}
Thanks in advance.
Learn something new every .001 second.
-
Aug 22nd, 2012, 02:45 PM
#2
Re: javascript window.open not working in IE
Hi there jlbantang,
IE requires that there are no spaces in the "Window Name".
So use one of these three options...
- PageTitle
- Page-Title
- Page_Title
~ the original bald headed old fart ~
-
Aug 28th, 2012, 02:48 AM
#3
Thread Starter
Fanatic Member
Re: javascript window.open not working in IE
Thanks works like a charm. Since all webpage are declared is there also a way to close all popup window when user logout from main page.
Something like these
Code:
function closeall_hwnd(){
if (false == ndelivery.closed){
ndelivery.close();
}
}
HTML
Code:
<a href="logout.aspx" onclick="closeall_hwnd();"> Logout </a>
but with no result.
Learn something new every .001 second.
-
Aug 28th, 2012, 04:03 AM
#4
Re: javascript window.open not working in IE
Hi there jlbantang,
bearing in mind that many users have javascript disabled
or pop up windows blocked, this is how I would code it...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>
<script type="text/javascript">
function init(){
mywindow=null;
title='Page-Title';
w=400;
h=500;
l=(screen.width-w)/2;
t=(screen.height-h)/2;
features='width='+w+',height='+h+',left='+l+',top='+t;
document.getElementById('openpop').onclick=function(){
if(mywindow) {
mywindow.close();
}
mywindow=window.open(this.href,title,features);
mywindow.focus();
return false;
}
document.getElementById('closepop').onclick=function(){
if(mywindow) {
mywindow.close();
}
}
}
window.addEventListener?
window.addEventListener('load',init,false):
window.attachEvent('onload',init);
</script>
</head>
<body>
<div>
<a id="openpop" href="supplier.aspx?src=rpt&tar=costcentre">open pop-up window</a>
<a id="closepop" href="logout.aspx">log out</a>
</div>
</body>
</html>
Last edited by coothead; Aug 28th, 2012 at 04:11 AM.
~ the original bald headed old fart ~
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|