Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cross browser resize window script

Status
Not open for further replies.

hablablow

Programmer
Sep 9, 2000
115
FR
hi there,
is there a cross browser resize window script onclick ?
 

AFAIK, "window.resizeTo(width, height);" is fairly cross-browser (it works for me in IE, NN, and FF at least).

Making this happen onclick would not be a good idea, IMHO - it would seriously annoy a lot of users every time they clicked (especially if they kept resizing their windows back to how they like it only to be resized by your code again... you know - personal preference, not like "all your windows are belong to us").

Dan


The answers you get are only as good as the information you give!

 
Hi Billy,
thanks for your answer.
To avoid the user the downside of the script wich efectively
proposes one an option to resize his window, once the window is resized, is there a function called on an onclick event to resize the window back to its original size.
Such as window size history go -1.
 
window.resizeTo(width, height);
could i use it this way:

<script type="text/javascript">
function resize() {
window.resizeTo(width, height);
}
</script>

<a href="#" onclick="resize"> ... </a>
 
No - you'd have to put brackets after the function call:

Code:
<a href="#" onclick="resize[b]()[/b]"> ... </a>

And you'd also need to define "width" and "height".... although personally, I would strongly advise against using those as variable names. The only resaon I used "width" and "height" in my example was to show you what the paremeters were.

I would also avoid calling your function "resize", as there is already a method called "resize" in IE. Call it something like "myResize", etc.

Dan


The answers you get are only as good as the information you give!

 
Dan >> thanks a lot
CliveC > are you responding to the question if there is a function to restore with another script the browser original size ?
 
I am using a single browser window so this could be possible
even if this window is the parent.
Any idea of a script that could restore the window to its initial size before it was resized
something like script.go -1.
I don't know if this is possible anyway, i mean to restore back any action done with javascript...
If you have any idea...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top