is there any way to limit window size w/ dreamweaver?

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

is there any way to limit window size w/ dreamweaver?

Postby sietinso » Wed 02 Feb, 2005 11:26 am

i created a webpage in dreamweaver, and only want the browser window to open to exactly 975 X 719 pixels (the size of my background image). is there any way to control this?

someone told me that it can be done through java script?

can anyone out there help with this?

please???

-brooke
:?
UserAgent: Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
sietinso
new member
new member
 
Posts: 2
Joined: Wed 02 Feb, 2005 11:19 am

Re: is there any way to limit window size w/ dreamweaver?

Postby Antony » Wed 02 Feb, 2005 6:54 pm

Although not recommended, but you can do so with JavaScript.
[tt]window.open("URL", "windowName", "width=975,height=719");[/tt]

e.g.
Code: Select all
<a href="#" onClick='window.open("http://netscape.com/", "newWindow", "width=975,height=719");'>Click here to open window in fixed size</a>
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.6 (KHTML, like Gecko) Safari/125.12
User avatar
Antony
diamond member
diamond member
 
Posts: 14510
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby sietinso » Thu 03 Feb, 2005 11:07 am

Thanks for the reply. Could you show me where I would paste the java script in this code to automatically control the window size when the page is loaded? I have a background .jpg and i only want the window to open
as big as the image. It looks horrible on large monitors with all of the extra space around the image.

-Brooke


Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
   margin-left: 0px;
   margin-top: 0px;
   background-color: #000000;
}
body,td,th {
   color: #CC0000;
}
.style4 {
   font-size: 10px;
   font-family: Arial, Helvetica, sans-serif;
}
.style5 {font-size: 9px; font-family: Arial, Helvetica, sans-serif; }
.style6 {font-size: 10px}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>

<body>
<img src="weekscovermenu.jpg" width="975" height="719" border="0" usemap="#Map">
<map name="Map">
  <area shape="poly" coords="46,312,60,299,74,316,114,380,134,440,133,466,132,479,134,513,131,550,
146,585,141,643,128,671,112,671,94,679,73,682,47,679,36,669,27,625,20,554,29,509,
30,479,35,438,37,396,43,345" href="latest.html" target="_blank">
  <area shape="poly" coords="524,423,517,449,509,478,519,519,550,542,578,554,596,547,603,537,610,515,
615,503,622,489,628,465,628,444,623,419,611,403,591,394,571,390,550,395,535,407" href="performance.html" target="_blank">
</map>
</body>
</html>


lines break by Admin
UserAgent: Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
sietinso
new member
new member
 
Posts: 2
Joined: Wed 02 Feb, 2005 11:19 am

Postby Antony » Thu 03 Feb, 2005 6:39 pm

sietinso wrote:Thanks for the reply. Could you show me where I would paste the java script in this code to automatically control the window size when the page is loaded? I have a background .jpg and i only want the window to open
as big as the image. It looks horrible on large monitors with all of the extra space around the image.
Brooke,
I thought you want to open a new window in specified size.

Well, you will need to resize the window, which many browsers disable you to do so. For me personally, I am fine with a new window opened in specified dimemsion, but if the webmasters resize my current browser window, I won't be happy.

A better way is to centre the image in the page, and don't change users' browser window size.

Do you want to code to resize the window?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.6 (KHTML, like Gecko) Safari/125.12
User avatar
Antony
diamond member
diamond member
 
Posts: 14510
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Center new window?

Postby Willem Defijn » Thu 03 Mar, 2005 2:01 pm

Dear Antony or anybody willing to help,
Thanks for the JavaScript code to size a new window in Dreamweaver. I will use it to show a larger size of my pictures when visitors click a thumbnail size.
In addition, is there a way to position this new window? Let's say, center it?
Thanks,
Willem Defijn
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Willem Defijn
new member
new member
 
Posts: 1
Joined: Thu 03 Mar, 2005 1:53 pm
Location: Antwerpen

Java script from Antony

Postby Rainner » Thu 21 Apr, 2005 3:48 pm

Hi Antony

The Java code you had posted for aspecifed window size has my interest. I tried it and its kind of what Im looking for.

I'm wondering if I can do this with it.

On my new home page, I want a link "joke of the day".

I want the user to click it and get a smaller window to apear with the joke. Its own window, over the main page thats opened.

Can this be done?

Thanks for any directionb :)

Cheers!
:?:
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Rainner
new member
new member
 
Posts: 2
Joined: Thu 21 Apr, 2005 3:41 pm
Location: Hot Springs, NC

Re: Center new window?

Postby Antony » Thu 21 Apr, 2005 7:23 pm

Willem Defijn wrote:Dear Antony or anybody willing to help,
Thanks for the JavaScript code to size a new window in Dreamweaver. I will use it to show a larger size of my pictures when visitors click a thumbnail size.
In addition, is there a way to position this new window? Let's say, center it?
Thanks,
Willem Defijn
Hello Willem,
You can spedify the position for the new pop-up window.
If you want to position it at centre of the monitor, you can do a math to figure out the screen width and screen height, then, substrate the width and height of the new windows, then divide the number by two (round it).

e.g. Assume you want a new window with 150 pixel height and 250 pixel wide.

[tt]posTop = (screen.availHeight - 150)/2;
posLeft = (screen.availWidth - 250)/2;
function openNewWindow() {
newWindow = window.open("http://netscape.com/", "newWindow", "height=150,width=250,left=posLeft,top=posTop");
return true;
}[/tt]

and in HTML,
[tt]<a href="javascript:openNewWindow()">click here to open a new window</a>[/tt]

Note, please remember that some users might have dual display, position at middle is annoying to them.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
User avatar
Antony
diamond member
diamond member
 
Posts: 14510
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Re: Java script from Antony

Postby Antony » Thu 21 Apr, 2005 7:26 pm

Rainner wrote:I want the user to click it and get a smaller window to apear with the joke. Its own window, over the main page thats opened.
You can use
[tt]window.open("URL", "windowName");[/tt]
and where [tt]URL[/tt] specifies the URL to the joke.

You will need to put each Joke in it's page.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/312.1 (KHTML, like Gecko) Safari/312
User avatar
Antony
diamond member
diamond member
 
Posts: 14510
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Thank you!

Postby Rainner » Thu 28 Apr, 2005 3:55 pm

thanks alot!

rainner
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Rainner
new member
new member
 
Posts: 2
Joined: Thu 21 Apr, 2005 3:41 pm
Location: Hot Springs, NC

Postby viatech » Mon 28 Nov, 2005 9:00 pm

Okay quick question for all of you. I was browsign google for help on this topic and discovered this discussion.

My question is as follows.

I would like to make a sized window popup (just like the above) with from within a flash document. The new window I would like to be a new page with just an image within it after clicking on a button inside of my swf document. I know that you can combine javascript with actionscript to perform certain actions, but I seem to somehow not be able to do this. Any advice?

What I have so far is:

on (release) {
getURL("javascript:window.open("URL","windowName","width=975,height=719"); ");

}
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
viatech
new member
new member
 
Posts: 1
Joined: Mon 28 Nov, 2005 8:46 pm


Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot], Yahoo [Bot]