[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Javascript window resize for Netscape.

Posted on 2004-11-03
5
Medium Priority
?
221 Views
Last Modified: 2006-11-17
Hi I've been using this script (below) to autosize a popup window.
But this script only works in IE, I need it to work in IE and Netscape.
So I need this altered to work or a similar script that will work for both.

<script type="text/javascript">
function init(){

var width  =  document.all['contents'].clientWidth;
var height =  document.all['contents'].clientHeight;
window.resizeTo(width +10, height +25);

}
</script>
</head>

<body onLoad="init()">

Thanks
bert
0
Comment
Question by:bertmn
5 Comments
 
LVL 13

Expert Comment

by:StormyWaters
ID: 12489219
If 'contents' is an id, change all instances of document.all['contents'] to document.getElementById('contents')
0
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 1000 total points
ID: 12489254
<script>
function init(){
 width= (document.body.clientWidth|| window.innerWidth)
 height= (document.body.clientHeight|| window.innerHeight)
 window.resizeTo(width +10, height +25)
}
</script>

<body onLoad="init()">
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 12489445
or you can use:

screen.width
screen.height

these return entire width and height of the actual cumputer screen

0
 

Author Comment

by:bertmn
ID: 12489695
Thanks, works good.

But as that window is refreshed it shrinks a little each time.
Do you know why?
0
 
LVL 31

Expert Comment

by:GwynforWeb
ID: 12489950
Thx for the points. One of the them does not include the toolbars/scrollbars (can not remmeber which one), try outerWidth as well. If you just want to increase the window size by an amount use window.resizeBy(10,25)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question