Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Javascript: auto fit window?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedJavascript: auto fit window?

 Post Reply Post Reply
Author
pilot99 View Drop Down
Groupie
Groupie


Joined: 05 July 2004
Status: Offline
Points: 167
Direct Link To This Post Topic: Javascript: auto fit window?
    Posted: 28 August 2005 at 2:52pm
i know how to change the window size through javascript but i was wondering if it possible to make it auto fit so if something expands so does the window.
Back to Top
pilot99 View Drop Down
Groupie
Groupie


Joined: 05 July 2004
Status: Offline
Points: 167
Direct Link To This Post Posted: 04 September 2005 at 9:46pm
someone please this is important.
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Direct Link To This Post Posted: 06 September 2005 at 6:57pm

i'm pretty sure you can use javascript to check the value of the width/height properties of objects. set up a function that checks the value of the width and the resizes the window appropriately.

i have no idea about the exact syntax,  but there's one way you could do it...
Back to Top
skwfalcon16 View Drop Down
Groupie
Groupie


Joined: 07 November 2004
Status: Offline
Points: 41
Direct Link To This Post Posted: 11 September 2005 at 4:59pm
Not real sure what you're wanting the window to autofit to, but I use it to autofit pictures. Here's the code I use.

(This isn't my code, I just found it. It didn't have any dev. info, so don't get mad that I didn't include it)


//Function to open picture in new windows
function OpenImage(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open("/includes/showpicture.asp?img="+img,"",stringa);
}


I call it just like any other javascript:


<a href="javascript:OpenImage('whatever you want in here')">


And here's the code for the page to  display pictures.

<html>
<!--#include virtual="/includes/skin_file.asp" -->
<body onClick="self.close()" bgcolor="<% = strBgColor %>" topmargin="10" bottommargin="10" leftmargin="10" rightmargin="10">
<%
ShowPic = Request.Querystring("img")
ShowPic = Replace(ShowPic, " ", "%20")
Response.Write "<img src=" & ShowPic & " border='0' style='border: 1px solid rgb(128,128,128);' alt='Click Anywhere To Close Window'><br />"
%>
</body>
</html>


This works really well for me. Hopefully it helps you out.
Back to Top
pilot99 View Drop Down
Groupie
Groupie


Joined: 05 July 2004
Status: Offline
Points: 167
Direct Link To This Post Posted: 12 September 2005 at 8:28pm
yah ive already stumbled upon that but its not an image.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.