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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a WEB page in a Specific area on screen 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
Is there a way to set the corners and width of a WEB page to open on screen in a specific place every time when it is launched?
I am creating a help guide for our intranet and want it to open in the upper right of the screen.

TIA

DougP, MCP, A+
 
Yup. There's a way. And here it is:

[tt]
function popup() {
var window_width = 300;
var window_height = 300;
var window_top = 0;
var window_left = screen.width - window_width;
var window_features = "height=" + window_height + ",width=" + window_width + ",top=" + window_top + ",left=" + window_left;
var win = window.open(" "new_window", window_features);
}
[/tt]

window_width is the width of the popup window
window_height is the height of the popup window
window_top is the pixel number where you want the top of the popup window to appear (0 means the top-most pixel)
window_left is the pixel number where you want the left side of the popup window to appear.

HTH.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Ok so what do I do with it?
Do I need Javascript or vbscript or something
when I paste it in it just shows on the Preview page
like so

function popup() { var window_width = 300; var window_height = 300; var window_top = 0; var window_left = screen.width - window_width; var window_features = "height=" + window_height + ",width=" + window_width + ",top=" + window_top + ",left=" + window_left; var win = window.open(" "new_window", window_features); }

Also how do I call a local page, not a http:// ...
but one thats in the same folder on the C:\drive


DougP, MCP, A+
 
OK I got it
<script type="text/javascript">
function popup() {
var window_width = 300;
var window_height = 300;
var window_top = 0;
var window_left = screen.width - window_width;
var window_features = "height=" + window_height + ",width=" +

window_width + ",top=" + window_top + ",left=" + window_left;
var win = window.open(" "new_window",

window_features);
}
</script>

[red]but how do I call it?[/red]

DougP, MCP, A+
 
Code:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">[/URL]
<html>
<head>
<title>
Test Popup
</title>
<script type="text/javascript" language="javascript">
function popup() {
    var window_width = 300;
    var window_height = 300;
    var window_top = 0;
    var window_left = screen.width - window_width;
    var window_features = "height=" + window_height + ",width=" + window_width + ",top=" + window_top + ",left=" + window_left;
    var win = window.open("[URL unfurl="true"]http://www.google.com",[/URL] "new_window", window_features);
}
</script>
</head>
<body onload = "popup()">
<p align = "center">
This is what you do with it.
</p>
</body>
</html>

Glen
 
Code:
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">[/URL]
<html>
<head>
<title>
Test Popup
</title>
<script type="text/javascript" language="javascript">
function popup() {
    var window_width = 300;
    var window_height = 300;
    var window_top = 0;
    var window_left = screen.width - window_width;
    var window_features = "height=" + window_height + ",width=" + window_width + ",top=" + window_top + ",left=" + window_left;
    var win = window.open("[COLOR=red]fileInTheSameFolder.htm[/color]", "new_window", window_features);
}
</script>
</head>
<body onload = "popup()">
<p align = "center">
This is what you do with it.
</p>
</body>
</html>

Glen
 
Should've been pathToFileInWebSpace.htm Ie. ../file.htm ( up a directory) or folderName/file.htm ( directory in same directory popups/file.htm) or ../folderName/file.htm (up a directory in a folder)

Glen
 
Were close

here is waht I have

<html>
<head>
<title>
Test Popup
</title>
<script type="text/javascript" language="javascript">
function popup() {
var window_width = 300;
var window_height = 300;
var window_top = 0;
var window_left = screen.width - window_width;
var window_features = "height=" + window_height + ",width=" + window_width + ",top=" + window_top + ",left=" + window_left;
var win = window.open("../catlist.htm", "new_window", window_features);
}
</script>
</head>
<body onload = "popup()">
<p align = "center">
This is what you do with it.
</p>
</body>
</html>

Not opening though "catlist.htm" is in the same folder on my c:drive
If I change it to " is works perfect

DougP, MCP, A+
 
If it's in the same folder as this html page, you don't need the "../" in the code. Just catlist.htm

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
well people
I tried all of these

var win = window.open("../catlist.htm", "new_window", window_features);


var win = window.open("c:/sdp/catlist.htm", "new_window", window_features);


var win = window.open("catlist.htm", "new_window", window_features);

nothing happens. I have the Google Toolbar popup blocker shut off.
Like I said google can up once, but it won't come up anymore
I was getting a popup window with nothing except "page cannot be found on server" now I don't even get that, No popup box at all.

DougP, MCP, A+
 
Something funny
the icon for my page 'catlist.htm' is different it is not a normal WEB icon the big "E" it looks like a vbscript icon or something. ther emust be something in that page telling Windows XP to change the icon which may be why it is not working correctly.

I don't know
I going to make a simple nothing page and see it I can open it in a pop up


DougP, MCP, A+
 
try this:

1. In Windows Explorer, right click on your catlist.htm file.
2. Click on Open With...
3. Click on Choose Program
4. Select Internet Explorer from the list. Check the
"Always use this program to open this kind of file" checkbox.

Now, try running your webpage again.

Does it work?

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Well it opens in IE if I double click it of course it is full screen.
Can I add code to that page itself instead of having to call it from another page?
So when it is double clicked it will just show up in the upper right as my original post at the top.

See there is just the one page I don't have a whole site. just one page.

catlist.htm
that's it

DougP, MCP, A+
 
No problem...

Just put the following code into the BODY ONLOAD event of catlist.htm:

[tt]window.moveTo(screen.width - 300, 0);[/tt]

Normally I would shun hard-coding the 300, but window.width cannot be calculated until after the complete <BODY> tag has been passed through. To see what I mean, put alert(window.width); in the body onload event. You'll see "undefined".

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
cLFlaVA,

That's what I've been looking for the whole time !!!!
how 'bout a star




DougP, MCP, A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top